Adjust time format label LB Hourly plot

I was wondering how to adjust the time format in the label of LB Hourly plot from “6 am” to “06:00”, “12pm” to “12:00” and “6pm” to “18:00” etc. ? Thanks for any reply.

this is also my problem

Hi @Jurrijn @letmegraduate
You need to rewrite the ladybug source python code. The path is C:\Program Files\ladybug_tools\python\Lib\site-packages\ladybug\hourlyplot.py

#_hour_text.append(‘{} {}’.format(hr_val, am_pm))
_hour_text.append(‘00:00’,)
_hour_text.append(‘06:00’,)
_hour_text.append(‘12:00’,)
_hour_text.append(‘18:00’,)
_hour_text.append(‘24:00’,)

Thank you for your help. I would try

Hi Minggangyin, Thanks for your suggestions. I am not a python specialist but try to rewrite the code.
Where should I copy/paste or replace the text? Below in the screenshot I found the relevant part I assume (between rules no. 474 - 502).
Thanks again for your help!

@Jurrijn
You can modify the line 520 to 525 as the screenshot show.I upload the modify version of hourplot.


hourlyplot 0601.py (24.8 KB)

It would be very nice if this could be added as a feature, there are many of us that use the 24h clock.
The am/pm is used only in a small subset of the world.

@chris ?

1 Like

@minggangyin do you think it is also possible to do this by modifying the sources:

and how?
Thanks
Massimiliano

@MassimilianoBusnelli
I have no idea about this.

Ok thanks @minggangyin . I renamed your file “hourlyplot 0601.py” to “hourlyplot.py” and droped in the folder “…Lib\site-packages\ladybug”. Unforfortunaly It doesn’t work. Even if I manually insert " _hour_text.append(‘00:00’,) etc." lines 521 to 525 as in your screenshot in my original hourlyplot file. I got this message in the component LB hourlyplot: 1. Solution exception:unexpected token ‘‘’ How could I solve this problem? I upload my manually inserted text in the hourlyplot file.
hourlyplot.py (23.8 KB)

Hi @Jurrijn It is a simple Python bug for your code. You should align th code like this


I suggest you to use Visual Studo Code to edit the hourploy.py.

Thanks for your help @minggangyin for now it works fine with the solution suggestion 2 of Chris. See below in the screenshot. I change the code direct in the Hourly plot component

2 Likes

Sorry for the late response, @Jurrijn .

Hacking it inside the component like your last sample is how I would recommend doing it for now. I would not recommend touching the source code of the core libraries if you can avoid it.

I made a small tweak to the core library source code to make it easier to get these time labels in the future, which will generally help out people who want to customize the graphics on the SDK layer:

… such that this is eventually all that you will need to get the 24-clock format:

I’m not 100% convinced that this option should be exposed on the component but the fact that 4 people in this post have already said they want it is pretty compelling. If there are two more people who post on this topic to say that they want it exposed, then I’ll add an input to the component for it.

1 Like

Thanks Chris! I’ll try it soon.

FYI, I just decided that I’ll expose the clock_24_ option on the component:

I figured that enough people have chimed in here that it will get plenty of use. The updated component should be available with the LB Versioner shortly.

5 Likes