Skip to content

Commit 4e9dcc9

Browse files
authored
Merge pull request #97 from best-practice-and-impact/nh/plotly-testing-fixes
feat(plotly): fixes from Plotly testing
2 parents 5559ce2 + 169ac34 commit 4e9dcc9

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/afcharts/cookbook/03-plotly-usage.qmd

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# | eval : true
1010
# | output: false
1111
12-
import pandas as pd
1312
import plotly.express as px
1413
import plotly.graph_objects as go
1514
@@ -98,7 +97,6 @@ This line chart uses the afcharts theme. There are pale grey grid lines extendin
9897
# | eval: true
9998
# | output: false
10099
101-
import pandas as pd
102100
import plotly.express as px
103101
import plotly.graph_objects as go
104102
@@ -192,7 +190,6 @@ Legends should be avoided unless absolutely necessary, as these usually rely on
192190
#| eval: true
193191
#| output: false
194192
195-
import pandas as pd
196193
import plotly.express as px
197194
import plotly.graph_objects as go
198195
@@ -247,7 +244,6 @@ This bar chart uses the afcharts theme, and shows the populations of the five mo
247244
#| eval: true
248245
#| output: false
249246
250-
import pandas as pd
251247
import plotly.express as px
252248
import plotly.graph_objects as go
253249
@@ -405,7 +401,6 @@ This histogram uses the afcharts theme, and shows the distribution of life expec
405401
#| eval: true
406402
#| output: false
407403
408-
import pandas as pd
409404
import plotly.express as px
410405
import plotly.graph_objects as go
411406
@@ -469,7 +464,6 @@ This scatterplot uses the afcharts theme, and shows life expectancy against GDP
469464
#| eval: true
470465
#| output: false
471466
472-
import pandas as pd
473467
import plotly.express as px
474468
import plotly.graph_objects as go
475469
from plotly.subplots import make_subplots
@@ -625,7 +619,6 @@ This pie chart uses the afcharts theme, showing the proportions of European coun
625619
#| eval: true
626620
#| output: false
627621
628-
import pandas as pd
629622
import plotly.express as px
630623
import plotly.graph_objects as go
631624

src/afcharts/pio_template.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@
8181
},
8282
"hovermode": "x unified", # How hovering affects the display
8383
# x unified shows info for all the data at that point in the x-axis
84-
"paper_bgcolor": "rgba(0,0,0,0)", # Makes paper (entire area) background transparent
85-
"plot_bgcolor": "rgba(0,0,0,0)", # Makes plot area transparent
8684
"margin": { # Set margins around the plot area in pixels
8785
"l": half_line, # Left margin
8886
"r": half_line, # Right margin
@@ -94,16 +92,16 @@
9492
"uniformtext_mode": "hide", # Controls visibility of text based on size then the
9593
# text will be hidden - hide means that if a text element's size falls below the "uniformtext_minsize"
9694
"title": {
97-
"automargin": True,
9895
"text": None,
9996
"font": {
10097
"size": base_size * 1.6,
10198
}, # Title font size and colour
99+
'x': 0, 'xref': 'paper', # Title alignment
102100
"pad": {
103-
"t": half_line * 2,
104-
"l": half_line * 2,
105-
"r": half_line * 2,
106-
"b": half_line * 2,
101+
"t": half_line,
102+
"l": 0,
103+
"r": half_line,
104+
"b": half_line,
107105
}, # Padding above and below title
108106
},
109107
"xaxis": { # Configures the x-axis
@@ -142,5 +140,11 @@
142140
"zeroline": True,
143141
"zerolinecolor": af_colour_values["chart_features"],
144142
},
143+
},
144+
data={
145+
"scatter": [{
146+
"marker": {"size": 12},
147+
"line": {"width": 2.5}
148+
}]
145149
}
146150
)

0 commit comments

Comments
 (0)