Ok, I know this question might sound silly, but I cannot find out why the demo from the gnuplot official website (you can see an example on the left hand side in the picture below) looks different (and much nicer) than what I get from running the same demo on my machine (on a wxt terminal).
Is there a configuration file (something like a ~/.gnuplotrc) where a theme has been specified? If so, does anyone know what theme has been used here?
Here you have an image where you can compare the website and the locally-made versions
Moreover, just an off topic curiosity, is anyone using gnuplot seriously, or it's basically used to plot simple batch plots and for Octave?
It is very likely that the person who made the demo (likely Ethan Merritt) has defined his/her own set of default line colors, which are reflected in the demo images. You can do this yourself (see help set linetype). Example from gnuplot e-mail list:
# Ethan A Merritt - my preference for gnuplot colors
# 2 3 4 5 6 8 are borrowed from the colors_podo set
#
set linetype 1 lc rgb "dark-violet" lw 1
set linetype 2 lc rgb "#009e73" lw 1
set linetype 3 lc rgb "#56b4e9" lw 1
set linetype 4 lc rgb "#e69f00" lw 1
set linetype 5 lc rgb "#f0e442" lw 1
set linetype 6 lc rgb "#0072b2" lw 1
set linetype 7 lc rgb "#e51e10" lw 1
set linetype 8 lc rgb "black" lw 1
set linetype 9 lc rgb "gray50" lw 1
set linetype cycle 9
There are no built-in gnuplot themes, only sets of settings which change colors.
And yes, I do use gnuplot seriously! I use it both for simple plotting and for scientific publication.
There are nice palettes available at https://github.com/Gnuplotting/gnuplot-palettes and https://github.com/aschn/gnuplot-colorbrewer
These define line styles that you can use explicitly, but with some shell escaping tricks you can make them override the default linetypes, with something like this in your .gnuplot:
palettefile(n) = sprintf("<sed 's/set style line/set linetype/' /path/to/gnuplot-gnuplot-palettes/%s.pal", n)
load palettefile("rdbu")
You can then call load palettefile(palettename) (where palettename is one of the ones available in the palette repository) whenever you want to change the default palette, so gets quite close to the theming notion mentioned above.
It looks like you are using an older version - the demos are probably made with version 5, which has a new default palette. Your colors look like version 4 or below.
The new version has a lot of new, more powerful features. The new cariolatex terminal can produce really nice publication quality plots out of the box, or with very few tweaks.
The most recent versions of gnuplot (5) have the left hand colour palette by default (at least the wxt terminal). They mention it helps readers with colour blindness.
I suggest you type in: help set colorsequence.
p.s. I also use gnuplot always for all my scientific publications.
Although the result is similar to that of andyras, here is another solution:
as the default colours depend on the terminal type, switch to the desired terminal type with set term and then type
show linetype
Related
I am plotting data with y-errorbars on a pdfcairo terminal and have a problem to properly size the data points:
plot "test.data" u ($6) : 10 : 11 with yerrorbars pt 7 ps 0.5 t
ps 1 gives too large a point and decreasing ps gives strange results. Interestingly, on a windows terminal everything looks ok, but the pdfcairo terminal makes problems. What is wrong?
Hmm. I see a problem also but I do not know what causes it.
Workaround
Plot the data twice, once to show the error bars and once to show the variable size points. Here is a screenshot of the pdf output using gnuplot 5.4.4
set term pdfcairo
set output 'yerrorbar.pdf'
set sample 51
set xrange [0:1]
set key left reverse
plot '+' using 1:1:(0.2) with yerrorbar lc 'blue' pt 7 ps 0, \
'+' using 1:1:1 with points lc 'blue' pt 7 ps variable
I'm new with gnuplot loops, and I don't know why is it crashing...
I want to make a plot with 10 different .txt data files and after that 10 different plot from these .txt-s. (Sorry for my english)
note: I am using win 8.1 -> I know I should use gnuplot with Ubuntu but that's the situation for now...
So here is my script:
cd'C:\RégiPC\asztal222\TDK\fittnessmodell\fittnessmodell\Incidencia s0 pk emel\001'
set title "Fitness előny nélkül pk=0.7+=0.03"
set term png size 1280,768
set key tmargin left
set xlabel "Idő"
set ylabel "Populációméret"
set output "Incidencia_N_10.png"
p for[i=0:9] 'Incidencia_'.i.'.txt' u 1:2 title 'N'.i
// here I want to do 10 different curves in one plot
unset output
do for[i=0:9]
{
set output 'Incidencia_minden_'.i.'.png'
p 'Incidencia_'.i.'.txt' u 1:2 title 'N'.i , 'Incidencia_'.i.'.txt' u 1:3 title 'nacd'.i,'Incidencia_'.i.'.txt' u 1:4 title 'nscd'.i,'Incidencia_'.i.'.txt' u 1:5 title 'nscdplusd'.i
unset output
} // in this do for loop I want to do 10 different plots from 10 different .txt files
Please help and sorry if it is too trivial...
Thank you and Happy New Year!!!!
Good evening sir!
I use Ubuntu 14.04 and your code works fine with some change listed below.
1.) If you want to comment something you should use # instead of //.
2.) A problem occurs in the do for loop. You accidentally put the braces into a new line which is incorrect according to my gnuplot (version 4.6). The correct way to use it:
do for [i=0:9] {
set output 'Incidencia_minden_'.i.'.png'
p 'Incidencia_'.i.'.txt' u 1:2 title 'N'.i , 'Incidencia_'.i.'.txt' u 1:3 title 'nacd'.i,'Incidencia_'.i.'.txt' u 1:4 title 'nscd'.i,'Incidencia_'.i.'.txt' u 1:5 title 'nscdplusd'.i
unset output
}
After these changes the code don't make any error or crash in my computer.
I don't know if this works on Windows. You have to try it. :)
The MATLAB code I wrote is:
FigHandle = figure;
set(FigHandle, 'Position', [0, 0, 1060, 140]);
load('velocity0.dat')
v=reshape(velocity0,106,14)
vt=transpose(v)
pim=imagesc(vt) ;
set(gca,'XTickLabel',{'1','2','3','4','5','6','7','8','9','10'}, 'FontSize',11)
set(gca,'YTickLabel',{'0.15','0.35','0.55','0.75','0.95','1.15','1.35'}, 'FontSize',11)
xlabel('distance(km)')
ylabel('depth(km)')
C = colorbar('location','EastOutside');
caxis([2928,5553])
set(get(C,'XLabel'),'String','velocity(m/s)', 'FontSize',11)
I am trying to finish my paper for a scientific journal. The reviewers have asked for new images. However, I have not worked with the code for more than a year and I do not have MATLAB installed at my new job. As such, I asked my friend and got this image below.
Previously, the image looked like this in the past:
Should I change the code to get desired colors? Is this a colorbar issue?
Your friend is using R2014b or later where the default colour map is the parula colour map. The results you have previously are using the default colour map before R2014b, which is the jet colour map. As mentioned in the documentation regarding the default colour map:
colormap default uses the default colormap, which is the parula colormap with 64 colors. Versions of MATLAB® prior to R2014b use jet as the default.
Therefore if you want to display results in this colour map in versions of MATLAB that are R2014b or later, simply calling:
colormap jet;
... at the very end of your code will solve your problem. However, don't be tripped out with the colours. What you're concerned about is whether your data follows the distribution of the colour bar on the right. The colours are primarily just for visual display.
I use FORTRAN 77 code to generate data (saved as filename.dat) of simple physics situations containing x-y co-ordinates like a projectile.
My data files usually have 2 or 3 columns like so:
1 1
2 2
3 3
4 4
5 5
I can plot (2d and 3d) using Gnuplot just fine but I want to animate the point and make it look like a real projectile on the graph and then save it as a .gif file.
I am new to bash scripts so please assume I do not know a single thing about scripts, if it involves using those.
Thanks!
Problem solved. This is the code I am using:
set terminal gif animate delay 100
set output 'output.gif'
stats 'data.dat' nooutput
set xrange [-0.5:1.5]
set yrange [-0.5:5.5]
do for [i=1:int(STATS_blocks)] {
plot 'data.dat' index (i-1) with circles
}
Gnuplot version 4.6 or higher is required for this to work. This code must be entered in gnuplot. This requires the data to be in the following format:
1 1
2 2
3 3
4 4
printf "\033[1;32;40mGreen text on black background.\033[0m\n"
That is the green, but how can i get light green or other variation of color?
http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html , are only those color available for gnome-terminal as escape code?
Also how can i get bigger font with ruby?
using the "1" as the first parameter, as you are doing already, that's as "light" a green as you're going to get. this guy's webpage might be helpful: http://www.linuxfocus.org/English/May2004/article335.shtml
testing on urxvt:
[added later] there is a DEC extension for double-sized characters: Printing double-size characters with Ncurses but urxvt doesn't support it, I don't know about Gnome terminal.
With an offset of 90 you can create bright/high contrast colors.
See here for a reference. Wikipedia mentions the bright color range, but doesn't really explain how to use them (if I haven't missed it).
If you combine it with the bold style you can create 4 variations of a color.
Example:
It's a matter of the terminal support. The ansi codes that you list are interpreted by the terminal emulator and those codes are the only available colours (it comes from the days before windows and when 16 colours caused a stir).
If you need more you could consider using a graphical interface to your ruby app such as tk.
You can use an RGB escape code:
printf "\033[38;2;r;g;bmText\033[0m"
or, for background colour:
printf "\033[48;2;r;g;bmText\033[0m"
Just replace r, g, and b with the desired RGB value.