|
From: theozh <th...@gm...> - 2026-04-02 08:44:02
|
Hi Michael, I'm not aware that there is hypertext attached to objects, maybe in newer gnuplot versions. A simple solution would be to simply plot a hypertext `with labels` with a fully transparent point (`lc rgb 0xff123456`) on top of your object. You can set the hypertext pointsize a bit larger, e.g. ps 7, so that hovering with the mouse over the point will react earlier. However, I noticed that at least in wxt terminal >gnuplot 5.2.8, this doesn't seem to work anymore, i.e. you have to precisely hit the point. On qt terminal it still seems to work, haven't tested SVG. Your moon phases remind me to an earlier answer on StackOverflow: https://stackoverflow.com/a/77224783 Putting this together with the hypertext it could be something like this: ### moon phases with hypertext reset session set angles degrees set size ratio -1 # for northern hemisphere # x,y, phase, size, description # phases: 0=new moon, 0.5=full moon, 1=new moon $MoonPos <<EOD 0 0 0.00 1.0 "new moon" 3 0 0.125 1.0 "waxing crescent" 6 0 0.25 1.0 "first quarter" 9 0 0.375 1.0 "waxing gibbous" 12 0 0.50 1.0 "full moon" 15 0 0.625 1.0 "waning gibbous" 18 0 0.75 1.0 "last quarter" 21 0 0.875 1.0 "waning crescent" 24 0 1.00 1.0 "new moon" EOD array Moon[n_moon=40] # high enough even number to get a "round" shape r(x) = 2*(x - abs(x)) + 1 MoonX(n) = (a=360./n_moon*$0+90, s=$MoonPos[i/2+1], p=word(s,3), A=word(s,4), \ A*cos(a)*(i%2 ? a<=270 ? r(p-0.5) : r(0.5-p) : \ (a<=270 ^ p<=0.5) ? -r(p-0.5) : r(0.5-p)) + word(s,1)) MoonY(n) = A*sin(a) + word(s,2) set key noautotitle set style fill noborder set xrange[-2:26] plot for [i=0:|$MoonPos|*2-1] Moon u (MoonX(0)):(MoonY(0)):(i%2?0xffff00:0x000077) w filledcurves lc rgb var, \ $MoonPos u 1:2:5 w labels hypertext point pt 7 ps 7 lc rgb 0xff123456 ### end of script Am 01.04.2026 um 18:26 schrieb Michael Schuh: > Theozh, > > Thanks for the script. I learned about some nice gnuplot features by reading it and testing it. > > Is there a way to associate hypertext with objects? I would like to add hypertext labels for the moon phases it https://boardsailor.com/palo_alto/third_avenue_28_day_forecast.svg <https://boardsailor.com/palo_alto/third_avenue_28_day_forecast.svg> > > Thanks, > Michael > |