如何在Bash中绘制带指定X/Y轴标题的Gnuplot图表
Plotting a Rate-Distortion Curve with Gnuplot
Got it, here's how you can create that rate-distortion curve using your data file with Gnuplot:
You have two straightforward options to generate the plot—interactive mode for tweaking, or a one-line terminal command for quick execution.
Option 1: Interactive Gnuplot Session
- Open Gnuplot by typing
gnuplotin your terminal. - Enter these setup commands one by one to configure your plot:
set title "Rate Distortion Curve" set xlabel "bit rates" set ylabel "psnr" set grid - Then plot your data with lines and points (this makes the curve clear while highlighting individual data points):
The plot window will stay open until you close it, and you can tweak settings (like axis ranges) and re-runplot 'data' with lpreplotif needed.
Option 2: One-Line Terminal Command
If you want to skip the interactive session and generate the plot in one go, use this command:
gnuplot -p -e "set title 'Rate Distortion Curve'; set xlabel 'bit rates'; set ylabel 'psnr'; set grid; plot 'data' with lp"
A quick breakdown of the flags:
-p: Ensures the plot window stays open after Gnuplot finishes (otherwise it closes immediately).-e: Lets you pass all Gnuplot commands directly as a single string.
Just make sure your data file is in the same directory where you run the command, or replace 'data' with the full path to the file (e.g., '/home/yourname/documents/data') if it's stored elsewhere.
内容的提问来源于stack exchange,提问作者John
相关产品推荐
相关产品推荐

