@@ -202,8 +202,9 @@ fn grouped_box_plot() {
202202 plot. add_trace ( trace2) ;
203203 plot. add_trace ( trace3) ;
204204
205+ let y_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) ) ) ] ) ;
205206 let layout = Layout :: new ( )
206- . y_axis ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) )
207+ . y_axis ( y_axis )
207208 . box_mode ( BoxMode :: Group ) ;
208209
209210 plot. set_layout ( layout) ;
@@ -316,9 +317,10 @@ fn grouped_horizontal_box_plot() {
316317 plot. add_trace ( trace2) ;
317318 plot. add_trace ( trace3) ;
318319
320+ let x_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) ) ) ] ) ;
319321 let layout = Layout :: new ( )
320322 . title ( "Grouped Horizontal Box Plot" )
321- . x_axis ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) )
323+ . x_axis ( x_axis )
322324 . box_mode ( BoxMode :: Group ) ;
323325
324326 plot. set_layout ( layout) ;
@@ -361,19 +363,21 @@ fn fully_styled_box_plot() {
361363 ] ;
362364
363365 let mut plot = Plot :: new ( ) ;
364- let layout = Layout :: new ( )
365- . title ( "Points Scored by the Top 9 Scoring NBA Players in 2012" )
366- . y_axis (
367- Axis :: new ( )
366+
367+ let y_axis = Vec :: from ( [ Some (
368+ Box :: new ( Axis :: new ( )
368369 . auto_range ( true )
369370 . show_grid ( true )
370371 . zero_line ( true )
371372 . dtick ( 5.0 )
372373 . grid_color ( Rgb :: new ( 255 , 255 , 255 ) )
373374 . grid_width ( 1 )
374375 . zero_line_color ( Rgb :: new ( 255 , 255 , 255 ) )
375- . zero_line_width ( 2 ) ,
376- )
376+ . zero_line_width ( 2 )
377+ ) ) ] ) ;
378+ let layout = Layout :: new ( )
379+ . title ( "Points Scored by the Top 9 Scoring NBA Players in 2012" )
380+ . y_axis ( y_axis )
377381 . margin ( Margin :: new ( ) . left ( 40 ) . right ( 30 ) . bottom ( 80 ) . top ( 100 ) )
378382 . paper_background_color ( Rgb :: new ( 243 , 243 , 243 ) )
379383 . plot_background_color ( Rgb :: new ( 243 , 243 , 243 ) )
@@ -511,10 +515,13 @@ fn colored_and_styled_histograms() {
511515 . opacity ( 0.75 )
512516 . auto_bin_x ( false )
513517 . x_bins ( Bins :: new ( -3.2 , 4.0 , 0.06 ) ) ;
518+
519+ let x_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "Value" ) ) ) ] ) ;
520+ let y_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "Count" ) ) ) ] ) ;
514521 let layout = Layout :: new ( )
515522 . title ( "Colored and Styled Histograms" )
516- . x_axis ( Axis :: new ( ) . title ( "Value" ) )
517- . y_axis ( Axis :: new ( ) . title ( "Count" ) )
523+ . x_axis ( x_axis )
524+ . y_axis ( y_axis )
518525 . bar_mode ( BarMode :: Overlay )
519526 . bar_gap ( 0.05 )
520527 . bar_group_gap ( 0.2 ) ;
0 commit comments