I have a data file with 100 columns and thousands of rows, but I want to be able to select one single row, and in that row, use the even columns as the inputs for the X-axis and the odd columns as inputs for the Y-axis for a plot. Is there any way I can do that in gnuplot?
相关问题
- How to set a variable line width when plotting?
- Plotting multiple columns with ggplot2 [duplicate]
- How to create PNG images with more than 72dpi usin
- R markov chain package, is possible to set the coo
- Tick label text and frequency in matplotlib plot
相关文章
- How to plot smoother curves in R
- How to add clipboard support to Matplotlib figures
- Adding a legend to a matplotlib boxplot with multi
- R plot legend with transparent background
- How to plot a smooth 2D color plot for z = f(x, y)
- imshow when you are plotting data, not images. Rea
- Python Pyplot Bar Plot bars disappear when using l
- Label size in directlabels geom_dl()
So here the script I've done to plot a given line from a given data file with odd column as x-axis and even column as y-axis.
Let's explain this script:
First we specify the line number with
line_number
and the data filename withdata_file
. The effect ofset table table_file
is, as specified by gnuplot documentation, the print of points' coordinates in the file ̀table_fileinstead of ploting them with
plot`command.The
plot for[i=1:*:2]
plots for eachi
beginning from1
, ending when no more column can be ploted and incrementing by2
at each iteration. The idea is to take the columnsi
(i.e. odd) andi+1
(i.e. even) as coordinates (or use the inversei+1:i
to take even for x-axis and odd for y-axis).The part
"<(sed -n '".line_number."p' ".data_file.")"
is inspired from Gnuplot plotting data from a file up to some row and selects the line you specified as a file. Sinceset table
has been done, thisplot
command saves each coordinate to a new file. This is a trick to transform the line in a two column file.Finally the script disable the ̀set table
to then plot the saved file
table_file`I tested it with the following data file changing the line number from
1
to2
: