@@ -223,7 +223,7 @@ end subroutine initialize
223223!
224224! Add an x,y plot.
225225
226- subroutine add_plot (me , x , y , label , linestyle , markersize , linewidth , xlim , ylim )
226+ subroutine add_plot (me , x , y , label , linestyle , markersize , linewidth , xlim , ylim , xscale , yscale )
227227
228228 class(pyplot), intent (inout ) :: me ! ! pyplot handler
229229 real (wp), dimension (:), intent (in ) :: x ! ! x values
@@ -234,6 +234,8 @@ subroutine add_plot(me, x, y, label, linestyle, markersize, linewidth, xlim, yli
234234 integer , intent (in ), optional :: linewidth ! ! width of the plot line
235235 real (wp),dimension (2 ), intent (in ), optional :: xlim ! ! x-axis range
236236 real (wp),dimension (2 ), intent (in ), optional :: ylim ! ! y-axis range
237+ character (len=* ), intent (in ), optional :: xscale ! ! example: 'linear' (default), 'log'
238+ character (len=* ), intent (in ), optional :: yscale ! ! example: 'linear' (default), 'log'
237239
238240 character (len= :), allocatable :: xstr ! ! x values stringified
239241 character (len= :), allocatable :: ystr ! ! y values stringified
@@ -276,6 +278,10 @@ subroutine add_plot(me, x, y, label, linestyle, markersize, linewidth, xlim, yli
276278 if (allocated (xlimstr)) call me% add_str(' ax.set_xlim(' // xlimstr// ' )' )
277279 if (allocated (ylimstr)) call me% add_str(' ax.set_ylim(' // ylimstr// ' )' )
278280
281+ ! axis scales:
282+ if (present (xscale)) call me% add_str(' ax.set_xscale("' // xscale// ' ")' )
283+ if (present (yscale)) call me% add_str(' ax.set_yscale("' // yscale// ' ")' )
284+
279285 call me% add_str(' ' )
280286
281287 else
@@ -427,7 +433,7 @@ end subroutine add_3d_plot
427433!
428434! Add a bar plot.
429435
430- subroutine add_bar (me , left , height , label , width , bottom , color , yerr , align , xlim , ylim )
436+ subroutine add_bar (me , left , height , label , width , bottom , color , yerr , align , xlim , ylim , xscale , yscale )
431437
432438 class(pyplot), intent (inout ) :: me ! ! pyplot handler
433439 real (wp), dimension (:), intent (in ) :: left ! ! left bar values
@@ -440,6 +446,8 @@ subroutine add_bar(me, left, height, label, width, bottom, color, yerr, align, x
440446 character (len=* ), intent (in ), optional :: align ! ! default: 'center'
441447 real (wp),dimension (2 ), intent (in ), optional :: xlim ! ! x-axis range
442448 real (wp),dimension (2 ), intent (in ), optional :: ylim ! ! y-axis range
449+ character (len=* ), intent (in ), optional :: xscale ! ! example: 'linear' (default), 'log'
450+ character (len=* ), intent (in ), optional :: yscale ! ! example: 'linear' (default), 'log'
443451
444452 character (len= :), allocatable :: xstr ! ! x axis values stringified
445453 character (len= :), allocatable :: ystr ! ! y axis values stringified
@@ -494,6 +502,10 @@ subroutine add_bar(me, left, height, label, width, bottom, color, yerr, align, x
494502 if (allocated (xlimstr)) call me% add_str(' ax.set_xlim(' // xlimstr// ' )' )
495503 if (allocated (ylimstr)) call me% add_str(' ax.set_ylim(' // ylimstr// ' )' )
496504
505+ ! axis scales:
506+ if (present (xscale)) call me% add_str(' ax.set_xscale("' // xscale// ' ")' )
507+ if (present (yscale)) call me% add_str(' ax.set_yscale("' // yscale// ' ")' )
508+
497509 call me% add_str(' ' )
498510
499511 else
0 commit comments