Is there an option to turn on a tick mark along the time line of plots for sunrise and sunset?

57 views
Skip to first unread message

DR

unread,
Jul 14, 2026, 5:07:12 PM (7 days ago) Jul 14
to 'Jon Fear' via weewx-user
I cannot recall reading about such an option, or seeing it discussed,
but again my search skills aren't as sharp as some here.


I'm looking for a way to have a little tick mark along the hours on the
plots, or some of them at least, to indicate local sunrise and sunset. 
Just for the day would be OK, so nothing heavy duty on multiple day or
monthly plots.


It could be a little vertical mark, no need to write sunset or sunrise
by it since there isn't a lot of room there but especially for solar
radiation plotting it would be fun to have.

Dale


Vince Skahan

unread,
Jul 14, 2026, 6:04:47 PM (7 days ago) Jul 14
to weewx-user
https://weewx.com/docs/5.2/reference/skin-options/imagegenerator/?h=show_da#image_background_color

Gets you highlighted day night bands which is along the same lines.....

DR

unread,
Jul 14, 2026, 6:15:09 PM (7 days ago) Jul 14
to weewx...@googlegroups.com
Vince,

Indeed this is one of the coolest things  among so many that I saw when
I first heard of WeeWx and began setting it  up with my data.

Initially I tried blue  and yellow for color options but kept coming
back to what the designers set as the default.  But I digress.


It is very close but there is a bit of 'fuzziness' which I think
represents twilight and I can also look over at the Celestial to see
when the calculated sunrise/set is locally, too.


I just began paying attention to this when I got a station with solar
radiation working, turned on the max calculated solar and wondered how
close that was to what was being observed by the pyranometer.


In any event there is little more to add to this robust program you've
come up with and am having fun playing with it.  All I was trying to do
was emulate the little tick marks that Brian had in his Weather Display
graphing.

Thanks for the prompt reply and keep having fun.   Dale


Tom Keffer

unread,
Jul 14, 2026, 6:21:24 PM (7 days ago) Jul 14
to weewx...@googlegroups.com
Sounds like a good option to put in the image generator. See function _renderDayNight() in file weeplot/genplot.py. A PR would be welcome.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/486f03eb-8dd4-4259-a37b-20a35d9cc903%40gmail.com.

DR

unread,
Jul 14, 2026, 7:13:59 PM (7 days ago) Jul 14
to weewx...@googlegroups.com
Thanks for the pointer.  I was looking at the info Vince pointed me to
and I see that 'somehow' the image generator knows where day/night
begins and fuzzes it out a bit to represent twilight.  I just found that
section and will do some looking.  It might be simple enough for me to
figure out and report back.  Dale

DR

unread,
Jul 14, 2026, 7:51:39 PM (7 days ago) Jul 14
to weewx...@googlegroups.com
Would this be the code to study to try to figure out a 'simple'
solution, especially the last four lines?


    def _renderDayNight(self, sdraw):
        """Draw vertical bands for day/night."""
        (first, transitions) = weeutil.weeutil.getDayNightTransitions(
            self.xscale[0], self.xscale[1], self.latitude, self.longitude)
        color = self.daynight_day_color \
            if first == 'day' else self.daynight_night_color
        xleft = self.xscale[0]
        for x in transitions:
            sdraw.rectangle(((xleft,self.yscale[0]),
                             (x,self.yscale[1])), fill=color)
            xleft = x
            color = self.daynight_night_color \
                if color == self.daynight_day_color else
self.daynight_day_color
        sdraw.rectangle(((xleft,self.yscale[0]),
                         (self.xscale[1],self.yscale[1])), fill=color)
        if self.daynight_gradient:
            if first == 'day':
                color1 = self.daynight_day_color
                color2 = self.daynight_night_color
            else:
                color1 = self.daynight_night_color
                color2 = self.daynight_day_color
            nfade = self.daynight_gradient
            # gradient is longer at the poles than the equator
            d = 120 + 300 * (1 - (90.0 - abs(self.latitude)) / 90.0)
            for i in range(len(transitions)):
                last_ = self.xscale[0] if i == 0 else transitions[i-1]
                next_ = transitions[i+1] if i < len(transitions)-1 else
self.xscale[1]
                for z in range(1,nfade):
                    c = blend_hls(color2, color1, float(z)/float(nfade))
                    rgbc = int2rgbstr(c)
                    x1 = transitions[i]-d*(nfade+1)/2+d*z
                    if last_ < x1 < next_:
                        sdraw.rectangle(((x1, self.yscale[0]),
                                         (x1+d, self.yscale[1])),
                                        fill=rgbc)
                if color1 == self.daynight_day_color:
                    color1 = self.daynight_night_color
                    color2 = self.daynight_day_color
                else:
                    color1 = self.daynight_day_color
                    color2 = self.daynight_night_color
        # draw a line at the actual sunrise/sunset
        for x in transitions:
            sdraw.line((x,x),(self.yscale[0],self.yscale[1]),
                       fill=self.daynight_edge_color)

Tom Keffer

unread,
Jul 14, 2026, 8:08:20 PM (7 days ago) Jul 14
to weewx...@googlegroups.com
Yes, that's it.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages