I've created a file in notepad and saved it as ANSI and .dat file. The file structure looks like:
2019 371320
2018 352137
2017 323201
2016 302271
2015 291377
2014 282730
2013 273467
2012 257093
2011 244541
2010 223488
2009 216949
2008 197778
(...)
Then gnuplot terminal being opened I set the settings I want to and after the plot "dates1.dat" using 2:xticlabels(1) with boxes lt rgb "#406090" an error pops up:
Warning! Cannot find or open file "dates1.dat"
No data in plot
Whole settings:
# Output to PNG, with Verdana 8pt font
set terminal pngcairo nocrop enhanced font "verdana,8" size 640,300
# Don't show the legend in the chart
set nokey
# Thinner, filled bars
set boxwidth 0.4
set style fill solid 1.00
# Set a title and Y label. The X label is obviously months, so we don't set it.
set title "Number of registrations per month" font ",14" tc rgb "#606060"
set ylabel "Registrations (thousands)"
# Rotate X labels and get rid of the small stripes at the top (nomirror)
set xtics nomirror rotate by -45
# Show human-readable Y-axis. E.g. "100 k" instead of 100000.
set format y '%.0s %c'
# Replace small stripes on the Y-axis with a horizontal gridlines
set tic scale 0
set grid ytics lc rgb "#505050"
# Remove border around chart
unset border
# Manual set the Y-axis range
set yrange [100000 to 300000]
set output "6.png"
plot "dates1.dat" using 2:xticlabels(1) with boxes lt rgb "#406090"
The dates1.dat file is full of data as I showed before. Any thoughts on how to fix the problem?
In the gnuplot console type pwd which will print the current working directory. Is your file located in this directory? If not either give the full path, e.g.
plot 'C:/myDir/subDir/dates1.dat' ...
or change the working directory with cd. Check help pwd and help cd.
Related
I have the following snippet:
set grid
set xlabel "Entropy"
set ylabel "Amortized work"
set xrange [-0.05:1.05]
set style line 1 linecolor rgb '#516db0' linetype 2 linewidth 5
f(x) = -1.3973 * x ** 2 + 1.3947 * x + 0.5796
F = '$-1.3973 x^2 + 1.3947 x + 0.5796$'
set terminal cairolatex pdf input size 700,700 color colortext
set key opaque box lc "black" linewidth 3
plot 'RatioVerboseData.dat', f(x)
set output
The data file RatioVerboseData.dat looks like this:
0.93070 0.290710
0.94060 0.281450
0.95050 0.254771
0.96040 0.241656
When I run the script with the gnuplot, it outputs:
plot 'RatioVerboseData.dat', f(x)
^
cairolatex terminal cannot write to standard output
"EntropyVerboseData.plt", line 15: util.c: No error
I use gnuplot 4.6.7 and MiKTeX-pdfTeX 4.10 (MiKTeX 22.7)
You need to specify an output file. Otherwise gnuplot tries to write back to the input terminal (stdout). That makes sense for some terminal types, e.g. the "dumb" terminal, and is not revelant for terminal type with their own display window, e.b. "qt", "wxt". But it cannot work for terminal types that need to create multiple output streams and then combine them to produce the final document, which covers most (all?) of the LaTeX terminal types.
Add a line:
set output "RatioVerboseData.tex"
Why are you using a 7.5 year old gnuplot version? Current version is 5.4.
I can reproduce your observation (on Win10 with gnuplot 4.6.7) that gnuplot gets stuck.
I couldn't find a hint in help cairolatex, but I guess if you don't add units to the size it will be interpreted as inches. But this does not yet explain why gnuplot freezes when you want to create a 700in x 700in large graph.
Anyway, if you add units, I guess at least in and cm are accepted and if you add the output file as #Ethan already suggested then it should work.
...
set terminal cairolatex pdf input size 7cm,7cm color colortext
set output "RatioVerboseData.tex"
...
I'm trying to setup default representations on load, and currently have added the following to the default .vmdrc file.
display depthcue off
color Display Background white
display projection orthographic
mol default color {index}
mol default style {CPK 1.0 12 0.3 12}
mol default selection {all}
menu main move 62 1236
menu graphics move 166 1477
I have also tried this line:
mol default style CPK
And variations on the selection command, such as {name A}, since I'm using hoomd and A type particles, but all to no avail, it ignores the representation style and color settings no matter what I do, but the other settings work just fine. Anyone able to help me figure out why? Thanks.
This is due to the molecule not being read into vmd upon startup (at the time of your .vmdrc file being read). I suspect you start vmd from command line with "vmd molecule.file" rather than opening up vmd first, then loading in the molecule from the File > New Molecule tab. If you do it the former way, then your "mol" instructions in the .vmdrc file are being applied to a non-existent molecule. The latter should work with the commands you've provided.
See here for how to get these defaults working for you with a command line startup.
I'm trying to plot a discrete brownian path in gnuplot, which involves a lot of overlaping lines. This is how it's displayed in the qt terminal (I have generated the image with a screenshot):
Notice how the overlapping lines get colored in a stronger color, which is beautiful.
If I export it in png, with
set term pngcairo size 1366,768 enhanced
I obtain this:
All the lines have the same intensity. Setting transparent doesn't help, either.
The same happens with this MWE:
set term pngcairo size 1366,768 background '#000000' enhanced
set output "image.png"
unset key
set border 0
unset xtics
unset ytics
set samples 1e6
set xrange [0:0.1]
p sin(1/x) w l lw 0.3
set output
I'm running gnuplot -d each time so my local config does not get loaded. How should I export the plot to obtain the same effect as in the GUI?
Here are some results of my investigation :
I couldn't achieve beautiful results with pngcairo either. Opacity isn't added when 2 curves overlap each other.
Exporting to SVG and converting to PNG looked a bit better, either with inkscape -z -e image.png -w 1600 -h 1200 image.svg or convert -density 3000 -resize 1600x1200 image.svg image.png. This step could be included in gnuplot as a system command.
It is possible to export the qt render to png directly from the qt window. First menu icon on the left → Export to image
This process could in theory be automated directly from Gnuplot, without user interaction. A patch has been submitted : https://sourceforge.net/p/gnuplot/patches/665/. As far as I can tell, it hasn't been yet integrated into Gnuplot 5.0.x
Here is a related discussion on Gnuplot-dev.
If you feel adventurous, you could try to recompile Gnuplot with the applied patch. The submitter might be able to help you.
Very offtopic in this question, but as a workaround I have made a Julia script that replicates the image feeling that I am looking for. I will post it here in case anybody finds it useful.
using Images
function paint(Ny, Nx, iters=1e6; stepsize = 50)
randstep() = rand([-1;1])
x = Nx÷2
y = Ny÷2
M = zeros(Nx,Ny)
for i in 1:iters
rx = randstep()
ry = randstep()
for i in 1:stepsize
x = mod1(x+rx, Nx)
y = mod1(y+ry, Ny)
M[x,y] += 1
end
end
clamped = M/maximum(M)
img = [Colors.RGB(0,mm,0) for mm in clamped]
end
img = convert(Image,paint(1366,768,1e4,stepsize=10))
save("coolbrownianwalk.png", img)
This produces images like this:
I need to do this in a different way, since pcolor produces diagonal lines in the output file
h=pcolor(rand(16)); %The actual data comes from hist3
set(h,'EdgeColor','none');
colormap(gray(256));
set(gca,'yscale','log');
set(gca,'xscale','log');
print('test.png','-dpng','-r4800'); %Gives diagonal lines in text.png
Is there a simple workaround the bug. I use the FLTK backend.
Update
Switching to gnuplot removes the diagonal lines, but adds vertical and horizontal lines, but changes increases the plot margins too much.
Here is a "solution" to the bug. The idea is to disable anti-aliasing for graphics.
gswrapper.sh
#!/bin/bash
ARGS=()
ARGS+=("-dGraphicsAlphaBits=1")
for var in "$#"; do
[ "$var" != '-dGraphicsAlphaBits=4' ] && ARGS+=("$var")
done
gs "${ARGS[#]}"
Octave script:
h=pcolor(rand(16)); %The actual data comes from hist3
set(h,'EdgeColor','none');
colormap(gray(256));
set(gca,'yscale','log');
set(gca,'xscale','log');
print('test.png','-dpng','-r600','-G./gswrapper.sh');
I am exporting my Stata graphs as *.eps in order to implement them in LaTeX. I'm using the following options:
xtline bhar_pct if decile==1 | decile==10 | decile==11, overlay ///graphregion(color(white)) bgcolor(white) legend(region(lwidth(none) label(1 "Portfolio 1") label(2 "Portfolio 10") label(3 "Hedge Portfolio (10 - 1)")) plot1(lpattern(solid) lwidth(medium) lcolor(gs1)) plot2(lpattern(longdash) lwidth(medium) lcolor(gs1)) plot3(lpattern("---#") lwidth(medium) lcolor(gs8)) xlabel(0 (10) 50) xtitle("") ylabel(-10 (2) 10, angle(0)) ytitle("BHAR (in %)")
But still: the background is white, but there are "super light blue gridlines" inside the graph as well as as the border of my legend. Moreover, the graph has an "overall" blue border as well. By now I am trimming the graph in order to remove this border, but there must be a way to create "plain" graphs?
I had to convert the *.eps file to png, but cannot post it due to lack of reputations. So here is a link to it:
http://www.converthub.com/working/done/93b7cfd46b432b1312f78912e645a5cb/aar_crisis1_dsue1.png
How about:
clear all
set more off
*----- example data -----
sysuse xtline1
xtset person day
*----- what you want -----
xtline calories, overlay graphregion(color(white)) bgcolor(white) ylabel(, nogrid) ///
legend(region(lcolor(white)))
?