Skip to content

Strange line plots with Magics using python3/3.10.10-01  #104

@sylvielamythepaut

Description

@sylvielamythepaut

What happened?

Hello,

We've noticed some strange random results on a few EFAS line plots. I tracked it down to this example below where you can reproduce it. It's basically a "step plot" with dates on the x-axis, strangely the first point of the blue plot starts at a different tick x position, but only for the blue plot, even though both lines have the same dates.

I tried changing the plotting order, changing colours and other things and still just got errors with the blue plot. It looks like Magics does not like something about the data itself but what could it be!?

What are the steps to reproduce the bug?

//

from Magics.macro import *
xaxis = maxis(
axis_orientation='horizontal',
axis_type='date',
axis_days_label_height=0.47,
axis_months_label_height=0.47,
axis_years_label_height=0.47,
axis_grid='on',
axis_grid_colour='grey',
axis_grid_line_style='dot',
axis_days_sunday_label_colour='black',
axis_title='off',
)

yaxis = maxis(
axis_orientation='vertical',
axis_type='regular',
axis_position='left',
axis_tick_label_height=0.47,
axis_tick_position_list=[1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 1000.0],
axis_grid='on',
axis_grid_colour='grey',
axis_grid_line_style='dot',
axis_title='on',
axis_title_text='Upstream precipitation [mm/h]',
axis_title_height=0.53,
)

projection = mmap(
super_page_x_length=30.0,
super_page_y_length=12.0,
subpage_x_position=3.18,
subpage_y_position=2.15,
subpage_x_length=30.0 - 3.18 - 2.66,
subpage_y_length=12.0 - 2.15 - 2.43,
subpage_map_projection='cartesian',
subpage_x_axis_type='date',
subpage_y_axis_type='regular',
subpage_x_date_min='2023-09-11 06:00',
subpage_x_date_max='2023-09-13 18:00',
subpage_y_min=0.0,
subpage_y_max=4.8519707202911375,
page_id_line="off",
)
eud = minput(
input_x_type = 'date',
input_date_x_values = [
'2023-09-12 06:00', '2023-09-12 12:00', '2023-09-12 12:00', '2023-09-12 18:00',
'2023-09-12 18:00', '2023-09-13 00:00', '2023-09-13 00:00', '2023-09-13 06:00',
'2023-09-13 06:00', '2023-09-13 12:00'
],
input_y_values = [
.00000300183592, .00000300183595, .549081087, .549081093,
.00137403957, .00137403958, 1.72107053, 1.72107055,
4.41088247, 4.41088252,
],
)

eudg = mgraph(
graph_line_colour='rgb(1.0, 0.0, 0.0)',
graph_line_thickness=2,
graph_symbol='off',
graph_symbol_colour='rgb(1.0, 0.0, 0.0)',
graph_symbol_height=0.5,
graph_symbol_marker_index=15,
graph_symbol_outline='on',
graph_symbol_outline_thickness=2,
legend='on',
legend_user_text='WB(ECMWF-DET)',
)

dwd = minput(
input_x_type = 'date',
input_date_x_values = [
'2023-09-12 06:00', '2023-09-12 12:00', '2023-09-12 12:00', '2023-09-12 18:00',
'2023-09-12 18:00', '2023-09-13 00:00', '2023-09-13 00:00', '2023-09-13 06:00',
'2023-09-13 06:00', '2023-09-13 12:00'
],
input_y_values = [
.881707549, .881707558, .265411973, .265411976,
.00317582721, .00317582724, 2.47310567, 2.47310569,
3.23703074, 3.23703078,
]
)

dwdg = mgraph(
graph_line_colour='rgb(0, 0., 1.0)',
graph_line_thickness=2,
graph_symbol='off',
graph_symbol_colour='rgb(0., 0., 1.0)',
graph_symbol_height=0.5,
graph_symbol_marker_index=15,
graph_symbol_outline='on',
graph_symbol_outline_thickness=2,
legend='on',
legend_user_text='WB(DWD-DET)',
)

myoutput = output(
output_formats=['png'],
output_name_first_page_number='off',
output_cairo_antialias='on',
output_name='example_Rups_errorDWD'
)

plot(
myoutput, projection, yaxis, xaxis,
dwd, dwdg,
eud, eudg
)

Version

4.15.0

Platform (OS and architecture)

Darwin

Relevant log output

No response

Accompanying data

No response

Organisation

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions