I am having some problems with getting graphs
asked by Chamini Shammi Pathiraja (2021/04/18 21:43)
I have installed quaty and gnuplot successfully. But when I am running the quanty files (eg:XAS) it doesn't give me the plots. This is the message I get :
Execute the gnuplot to produce plots and convert the output into a pdf-file line 0: Cannot load input from ';'
line 0: Cannot load input from ';'
FINISHED
Answers
Does your code create a postscript (.ps) file before it hits an error? If so, you should be able to convert from .ps to .pdf just using an online converter to see what the plots should look like if they were created correctly. Just search “ps to pdf” on google and you should find plenty of services that can do it.
Also, have you changed anything in the original Quanty input files, or is this an error you are getting just from the regular boiler plate example?
Yes. I have the ps file and I converted them to pdf. Now I can see the plot. But do I need to do this every time. So my gnuplot is not working? I didn't change anything in the quanty file.
Yes, I think this means there is some issue with the way that gnuplot is being called to run the script. I assume you have gnuplot added to your path correctly. The two times that XAS.quanty calls the gnuplot command are in the lines:
os.execute(“gnuplot XASSpec.gnuplot ; ps2pdf XASSpec.ps ; ps2eps XASSpec.ps ; mv XASSpec.eps temp.eps ; eps2eps temp.eps XASSpec.eps ; rm temp.eps”)os.execute(“gnuplot SigmaTensor.gnuplot ; ps2pdf SigmaTensor.ps ; ps2eps SigmaTensor.ps ; mv SigmaTensor.eps temp.eps ; eps2eps temp.eps SigmaTensor.eps ; rm temp.eps”)
Try just running the command “gnuplot XASSpec.gnuplot” from the directory of your project, and see if you get the same error. If so, open the XASSpec.gnuplot file with notepad or some text editor and see if it matches mine:
set autoscale # scale axes automatically set xtic auto # set xtics automatically set ytic auto # set ytics automatically
set style line 1 lt 1 lw 2 lc rgb “#FF0000” set style line 2 lt 1 lw 2 lc rgb “#00FF00” set style line 3 lt 1 lw 2 lc rgb “#0000FF” set style line 4 lt 1 lw 2 lc rgb “#000000”
set xlabel “E (eV)” font “Times,12” set ylabel “Intensity (arb. units)” font “Times,12”
set out 'XASSpec.ps' set size 1.0, 1.0 set terminal postscript portrait enhanced color “Times” 12
set multiplot layout 4, 1 plot “XASSpecZ.dat” using 1:(-$3) title 'z-polarized' with lines ls 1,\
plot “XASSpecAVER.dat” using 1:(-$3) title 'Average' with lines ls 4,\
unset multiplot
Now, to be honest I do most of my plotting with Python, mainly because I couldn't quite figure out how to get gnuplot to work properly on my windows machine. If you want to do the same you really only need to read in the first and third column of any of the .dat files (such as XASSpecAVER.dat), and plot the 1st column as your x-values and the -1*(3rd column) as your y-values. This will at least allow you to start running Quanty scripts immediately and plotting them without worrying about getting gnuplot working.
Edit: When I tried to copy and paste the “XASSpec.gnuplot” file the formatting seems to have gotten a little wonky, so here is a link to a picture of what it looks like for me https://drive.google.com/file/d/1wQcafPrAiNbzWA4SMNm1OsqbQy_sNBzD/view?usp=sharing
Thank you. I will try this and let you know. I really appreciate your help.
The gnuplot file is same as yours. When I run the command gnuplot XASSpec.plot command, the command gives no error messages but no plots either. It again produces the .ps file.
I think I may have some issues with gnuplot.
So, if I want to use python for plotting should I rewrite a code seperately for that and run that after I getting the .dat file
Sorry for the late reply, you may have figured this out already, but yes you can just write a separate python code which reads in and plots the .dat file. For me, every Quanty project has its own directory with the Quanty script and a plot.py file which is set up to automatically read in and plot the .dat file that the Quanty script creates.
For example, here is one of my directories in which I calculate the K-edge emission spectrum for Chromium: https://drive.google.com/drive/folders/1B3fn9b4cg_DiLIdIXADY0KHUkUv-fkuI?usp=sharing Don't worry if the comments in the Quanty script don't make a lot of sense, I pulled this from one of the examples. Let me know if you still have any questions.