@@ -8,7 +8,8 @@ use plotly::{
88 Marker , Mode , Orientation , Pattern , PatternShape ,
99 } ,
1010 layout:: {
11- Annotation , Axis , AxisRange , BarMode , CategoryOrder , Layout , LayoutGrid , Legend ,
11+ AngularAxis , Annotation , Axis , AxisRange , BarMode , CategoryOrder , Layout , LayoutGrid ,
12+ LayoutPolar , Legend , PolarAxisAttributes , PolarAxisTicks , PolarDirection , RadialAxis ,
1213 TicksDirection , TraceOrder ,
1314 } ,
1415 sankey:: { Line as SankeyLine , Link , Node } ,
@@ -119,6 +120,29 @@ fn polar_scatter_plot(show: bool, file_name: &str) {
119120 let mut plot = Plot :: new ( ) ;
120121 plot. add_trace ( trace) ;
121122
123+ let ticks = PolarAxisTicks :: new ( ) . tick_color ( "#222222" ) ;
124+
125+ let axis_attributes = PolarAxisAttributes :: new ( )
126+ . grid_color ( "#888888" )
127+ . ticks ( ticks) ;
128+
129+ let radial_axis = RadialAxis :: new ( )
130+ . title ( "My Title" )
131+ . axis_attributes ( axis_attributes. clone ( ) ) ;
132+
133+ let angular_axis = AngularAxis :: new ( )
134+ . direction ( PolarDirection :: Clockwise )
135+ . rotation ( 45.0 )
136+ . axis_attributes ( axis_attributes) ;
137+
138+ let layout_polar = LayoutPolar :: new ( )
139+ . bg_color ( "#eeeeee" )
140+ . radial_axis ( radial_axis)
141+ . angular_axis ( angular_axis) ;
142+
143+ let layout = Layout :: new ( ) . polar ( layout_polar) ;
144+ plot. set_layout ( layout) ;
145+
122146 let path = write_example_to_html ( & plot, file_name) ;
123147 if show {
124148 plot. show_html ( path) ;
0 commit comments