@@ -202,8 +202,9 @@ fn grouped_box_plot() {
202
202
plot. add_trace ( trace2) ;
203
203
plot. add_trace ( trace3) ;
204
204
205
+ let y_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) ) ) ] ) ;
205
206
let layout = Layout :: new ( )
206
- . y_axis ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) )
207
+ . y_axis ( y_axis )
207
208
. box_mode ( BoxMode :: Group ) ;
208
209
209
210
plot. set_layout ( layout) ;
@@ -316,9 +317,10 @@ fn grouped_horizontal_box_plot() {
316
317
plot. add_trace ( trace2) ;
317
318
plot. add_trace ( trace3) ;
318
319
320
+ let x_axis = Vec :: from ( [ Some ( Box :: new ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) ) ) ] ) ;
319
321
let layout = Layout :: new ( )
320
322
. title ( "Grouped Horizontal Box Plot" )
321
- . x_axis ( Axis :: new ( ) . title ( "normalized moisture" ) . zero_line ( false ) )
323
+ . x_axis ( x_axis )
322
324
. box_mode ( BoxMode :: Group ) ;
323
325
324
326
plot. set_layout ( layout) ;
@@ -361,19 +363,21 @@ fn fully_styled_box_plot() {
361
363
] ;
362
364
363
365
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 ( )
368
369
. auto_range ( true )
369
370
. show_grid ( true )
370
371
. zero_line ( true )
371
372
. dtick ( 5.0 )
372
373
. grid_color ( Rgb :: new ( 255 , 255 , 255 ) )
373
374
. grid_width ( 1 )
374
375
. 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 )
377
381
. margin ( Margin :: new ( ) . left ( 40 ) . right ( 30 ) . bottom ( 80 ) . top ( 100 ) )
378
382
. paper_background_color ( Rgb :: new ( 243 , 243 , 243 ) )
379
383
. plot_background_color ( Rgb :: new ( 243 , 243 , 243 ) )
@@ -511,10 +515,13 @@ fn colored_and_styled_histograms() {
511
515
. opacity ( 0.75 )
512
516
. auto_bin_x ( false )
513
517
. 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" ) ) ) ] ) ;
514
521
let layout = Layout :: new ( )
515
522
. 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 )
518
525
. bar_mode ( BarMode :: Overlay )
519
526
. bar_gap ( 0.05 )
520
527
. bar_group_gap ( 0.2 ) ;
0 commit comments