From: Ethan M. <eam...@gm...> - 2025-02-15 01:33:47
|
On Friday, 14 February 2025 11:34:47 PST Dmitry wrote: > Hello Norwid, > thank you for your reply. The script I attached is just an example to > demonstrate the problem. > My actual plot is much more complicated, I have attached a .pdf example > of what I'm actually plotting. > Basically I have two datasets: one should be plotted with empty gray > points, and the second dataset should be plotted with filled colored > points. > Since I have a lot of data to plot, gnuplot just does not have enough > pointtypes of desired properties, so I decided to try unicode. > So far I ended up using > > plot [0:50] "battery.dat" with xyerrorbars pt -1 notitle ,\ > > "battery.dat" using 1:2:("▢") with labels offset 0, character 0.035 > > notitle > , where I adjust offset manually for each pointtype (unicode char) by > try and error method. That's how I plotted the attached pdf. > But it's far from ideal, since if decide to change the size of the plot, > all offsets are required to be readjusted. > I think that it would be great if gnuplot could offer more pointtypes, > since adding unicode points is a lot of pain because each character has > it's own shift. > > Or may be there are and easy way that I don't know about? That would be > great. I can offer two thoughts that may or may not be realistic options for you. 1) gnuplot's postscript terminal provides some huge number of point types, mostly partially filled squares and circles. That might be an option if you can deal with importing the figure as *.eps and if the point types are distinct enough for your purpose. 2) The gnuplot development branch supports a new graphical entity called a "mark". Each mark is essentially a graphics subroutine that draws a shape consisting of line segments and filled polygons. Once defined, a mark can be used in a "plot with marks" command directly analogous to "plot with points" except that there is more flexibility with respect to options for scaling. Defining new point types is an obvious example of use, shown here: https://gnuplot.sourceforge.net/demo_6.1/extra_points.html https://gnuplot.sourceforge.net/demo_6.1/mark_formulas.html This is an experimental extension added about a year ago. Until very recently it has been sadly lacking in documentation. Current documentation, such as it is, here http://gnuplot.info/docs_6.1/loc3934.html It is IMHO rather cumbersome to use in its current state. I suspect that as people begin to use it and offer feedback it will evolve into something easier to use. Ethan > Thanks! > > > On 14.02.2025 14:16, Norwid Behrnd via gnuplot-info wrote: > > @Dmitry Preface: I'm not yet convinced a character pointtype by `"\U+25A2"` > > improves the default tools available if one wants to indicate the points' > > location by a box. The difference is gnuplot's box does not use rounded > > corners -- is this a requirement on your side? Because depending on font and > > specific glyph, what is the origin of coordinates of its bounding box (in > > LaTeX's parlance) gnuplot uses a reference to put the glyph on the canvas -- > > is it in one of the bounding box' corners, or its center (then affected by the > > glyph's height and width)?[1] Would using the "rounded square" render the plot > > much easier to read, than gnuplot's box? Perhaps the script shared by you used > > `"\U+25A2"` as a place holder for a different printable object. > > > > My suggest is to use `pt 4` within the pdfcairo terminal to write an > > intermediate .pdf subsequently converted e.g., by David Barton's pdf2svg[2] > > in lines of `pdf2svg test.pdf out.svg`. As an illustration, I edited your > > script's header and last line to > > > > ``` test.spt > > set terminal pdfcairo enhanced font 'DejaVuSans,12' > > set output "test.pdf" > > > > set style data lines > > set title "error represented by xyerrorbars" > > set xlabel "Resistance [Ohm]" > > set ylabel "Power [W]" > > n(x)=1.53**2*x/(5.67+x)**2 > > NO_ANIMATION = 1 > > unset pointintervalbox > > #plot [0:50] "battery.dat" t "Power" with xyerrorbars pt "\U+25A1" pointsize > > 44 lw 2 lc "red", n(x) t "Theory" w lines #plot "battery.dat" t "Power" with > > points pt "\U+25A1" pointsize 44 lw 2 lc "red" > > > > plot [0:50] "battery.dat" with xyerrorbars pt -1 notitle ,\ > > "battery.dat" t "Power" with points pt 4 pointsize 1 lw 2 lc "red" > > ``` > > > > which works reasonably well (gnuplot 6.0.2). > > > > [1] see for instance `x` and `V` in the accepted answer by `theozh` (May 26, > > 2019) https://stackoverflow.com/questions/56313642/change-the-color-of-a-character-pointtype-in-gnuplot > > [2] http://cityinthesky.co.uk/opensource/pdf2svg/ > > > > > > _______________________________________________ > > gnuplot-info mailing list > > gnu...@li... > > Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |