LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2012, 07:33 PM   #1
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 127

Rep: Reputation: Disabled
Can someone help me with ngspice syntax to use gnuplot for output? Output blank!


I'm hoping someone here is familiar with ngspice who can guide me through this. I have been trying for days for a way to export ngspice plots/graphs to some kind of image file, like png, so I can post it to a web page or send via email.

I can use the hardcopy command to create an eps file, but it is not anywhere near as nice looking as the plot displayed with the plot command.

Someone had suggested I try gnuplot, but I haven't been able to get that to work for me. The ngspice manual section on using gnuplot for output is very terse, just a few sentences at 17.5.25, page 285.

test2.net is the name of the netlist I am currently working on. Here it is:
Code:
ngspice 2 -> listing
	bipolar transistor simulation 

     1 : bipolar transistor simulation 
     2 : .global gnd
     3 : i1 0 1 dc 75u
     4 : q1 2 1 0 mod1
     5 : vammeter 3 2 dc 0
     6 : v1 3 0 dc
     7 : .model mod1 npn
     9 : .end

When at the ngspice command prompt I do:
Code:
 ngspice 2 -> gnuplot test2 v(1)
I am presented with a new window with a gnuplot prompt. I was expecting a plot window!?!

As the manual says, ngspice creates three files, test2.data, test2.plt, and test2.eps. If I open the eps file (using a different terminal) it is blank, whether I open it with gv, gimp or anything else. The eps file is not empty, it just shows nothing.

I am unfamiliar with gnuplot, and don't want to have to learn all it's syntax just to get an image. I tried:
Code:
gnuplot> load 'test2.plt'
and that appears to write to test2.eps again (by looking at the timestamp), but again the test2.eps file when opened in gv is blank.

I am wondering if there is a problem with the way I'm asking gnuplot to write the output. Or could there be some kind of configuration parameter I need to set?

I'm using Debian with i3 tiling wm. In case it is helpful here is a link to the test2.eps file: www.strucktower.com/test2.eps

Any ideas?

Thanks,
Keith

Here is test2.plt:
Code:
keith@t520:~/gaf$ cat test2.plt
set title "bipolar transistor simulation "
set xlabel "V"
set ylabel "V"
set grid
unset logscale x 
set xrange [0.000000e+00:5.000000e+01]
unset logscale y 
set yrange [6.653309e-01:8.264312e-01]
#set xtics 1
#set x2tics 1
#set ytics 1
#set y2tics 1
plot 'test2.data' using 1:2 with lines lw 1 title "v(1)" 
set terminal push
set terminal postscript eps color
set out 'test2.eps'
replot
set term pop
replot
 
Old 03-26-2014, 05:19 PM   #2
sljunkie
Member
 
Registered: Nov 2008
Location: Brazil
Distribution: Manjaro
Posts: 105

Rep: Reputation: 18
Hi,

The command 'hardcopy' can help.

For example add these lines to /usr/share/ngspice/scripts/spinit :

Code:
** set hardcopy format
set hcopydevtype=postscript
set hcopypscolor=1
Do the analysis and then at the ngspice prompt:

Code:
hardcopy test.ps v(1)
You will have a colored .ps file ready to be printed/exported
 
Old 03-26-2014, 05:56 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
The .plt file looks reasonably decent. I am just not fond of .eps. It integrates nicely with Latex, but that is the only use I found for it.

First of all, check if your test2.dta contains sensible data. It should contain 2 columns. Column 1 the X-axis values, column 2 the Y-axis values.

If the test2.dta is correct, modify the last lines of the test2.plt to this:

Code:
set title "bipolar transistor simulation "
set xlabel "V"
set ylabel "V"
set grid
unset logscale x 
set xrange [0.000000e+00:5.000000e+01]
unset logscale y 
set yrange [6.653309e-01:8.264312e-01]
#set xtics 1
#set x2tics 1
#set ytics 1
#set y2tics 1
set term png size 800,600
set output "test2.png"
plot 'test2.data' using 1:2 with lines lw 1 title "v(1)"
Then do on the command line:
gnuplot < test2.plt (make sure the data file is in the current directory)

This should produce output. If you see error messages, post them.

Next, in the ngspice file control section you can specify gnuplot_terminal png. After running ngspice check the test2.plt file again and see that set term eps is replaced by set term png. Run the .plt file again with gnuplot < test2.plt and see what happens.

It is a nuisance that gnuplot is opened, the plot is created on screen and then once more put into a file. Unless you want to alter each .plt file you have to live with that.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash - output blank line after each command j0hnsmith Linux - General 2 10-22-2009 12:05 AM
weird sdiff output syntax question farkus888 Linux - General 1 07-13-2007 06:35 PM
Blank video output in VLC kamal.n2 Fedora 1 12-21-2006 10:17 AM
cron job mailing blank output rsmccain Linux - General 4 10-09-2006 04:00 PM
output number of blank lines tjgadu Linux - Newbie 7 06-09-2005 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration