Gnuplot problems (maybe wrong category)

  • Thread starter Inferior89
  • Start date
  • Tags
    Gnuplot
In summary, The conversation discusses the use of gnuplot and issues with the epslatex terminal. The poster shares their code and the results they are getting. They are advised to try using epslatex or gnuplot epslatex and are also encouraged to share the solution if they figure it out. Ultimately, it is revealed that the issue was with viewing the .dvi file instead of the .ps file. The poster shares the successful graphs once the issue is resolved.
  • #1
Inferior89
128
0
Hey, this might be the wrong place to ask this question but I have a few problems using gnuplot. The problem is that when using the epslatex terminal my labels on the axis dissapears.

This is the code I am using
Code:
set terminal latex or epslatex color or wxt
set output "psifunc.tex"
h = 1.054571628E-34
psi(x) = 1/((pi*h)**(1.0/4.0))*exp(-1/(2*h)*x**2)
set title ''
set format xy '$%g$'
set ylabel 'Sannolikhetstathet'
set xlabel '$A$'
set xrange [-4*sqrt(h/2):4*sqrt(h/2)]
set xtics ('$-4\sqrt{\frac{\hbar}{2}}$' -4*sqrt(h/2),\
     '$-2\sqrt{\frac{\hbar}{2}}$' -2*sqrt(h/2),\
     '0' 0,\
     '$2\sqrt{\frac{\hbar}{2}}$' 2*sqrt(h/2),\
     '$4\sqrt{\frac{\hbar}{2}}$' 4*sqrt(h/2)) nomirror
plot psi(x)**2 title '$|\psi_1(A)|^2$'
unset output

And here are the results:
http://i.imgur.com/rGW73.png

Don't really know why it is not working. It seems to work fine in the other terminals.
 
Physics news on Phys.org
  • #2
Perhaps try using epslatex, or gnuplot epslatex. If you figure out what is causing the problem, it would be great if you let us know how you fixed it.
 
  • #3
I figured it out but it is almost too embarrasing to say what I did wrong..

There was nothing wrong with my gnuplot code. The problem was I was only looking at the freaking .dvi file. What you need to do is run .dvi --> .ps and then watch the .ps file and everything will work.

Here are the graphs when I got it to work:

http://imgur.com/30Bll.png
http://imgur.com/4gZ8g.png
 

Related to Gnuplot problems (maybe wrong category)

What is Gnuplot and what are its main functions?

Gnuplot is a command-line based software for creating 2D and 3D plots from data. It is commonly used in scientific and technical fields to visualize data and make predictions. Its main functions include plotting data, customizing plots, and fitting data to mathematical models.

Why am I getting errors when trying to plot my data with Gnuplot?

There could be several reasons for errors when plotting with Gnuplot. Some common causes include incorrect data format, missing or incorrect plot commands, or incorrect syntax in the plot commands. It is important to carefully check the data and plot commands for any mistakes.

Can Gnuplot handle large datasets?

Yes, Gnuplot can handle large datasets with millions of data points. However, the performance may vary depending on the computer's capabilities. It is recommended to use the binary data format to speed up the plotting process for large datasets.

How can I customize the appearance of my Gnuplot plot?

Gnuplot offers a wide range of customization options for plots. You can change the plot type, colors, labels, axes, and many other features using various commands. It also allows for advanced customization using scripting languages like Python or Perl.

Is there a way to fit my data to a mathematical model in Gnuplot?

Yes, Gnuplot has built-in functions for fitting data to linear and non-linear mathematical models. It also supports user-defined functions for more complex fitting. Additionally, Gnuplot can plot the fitted curve along with the data points for visualization.

Similar threads

Replies
10
Views
433
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
24
Views
910
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
Replies
3
Views
483
Replies
1
Views
1K
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
989
  • Advanced Physics Homework Help
Replies
24
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
2K
Back
Top