Fix PR comments.
"""
Scatter Plots with alternate Y axis scale
----------------------------------
+-----------------------------------------
A few examples that make use of alternate Y axis scales.
"""
# category: simple charts
@@ -15,22 +15,28 @@ chart_df = pd.DataFrame(
'y': [2** x for x in range(0,20)],
}
)
+
base_chart = alt.Chart(chart_df).mark_line().encode(
- x=alt.X('x', type='quantitative'),
+ x=alt.X('x:Q'),
).properties(
height=200,
width=200,
)
-chart1 = base_chart.encode(
- y=alt.Y('y', type='quantitative'),
+
+chart_linear = base_chart.encode(
+ y=alt.Y('y:Q'),
).properties(title='linear')
-chart2 = base_chart.encode(
- y=alt.Y('y', type='quantitative', scale=alt.Scale(type='log', base=2)),
+
+chart_base_2 = base_chart.encode(
+ y=alt.Y('y:Q', scale=alt.Scale(type='log', base=2)),
).properties(title='log base 2')
-chart3 = base_chart.encode(
- y=alt.Y('y', type='quantitative', scale=alt.Scale(type='log', base=np.e)),
+
+chart_base_e = base_chart.encode(
+ y=alt.Y('y:Q', scale=alt.Scale(type='log', base=np.e)),
).properties(title='log base e')
-chart4 = base_chart.encode(
- y=alt.Y('y', type='quantitative', scale=alt.Scale(type='log')),
+
+chart_base_10 = base_chart.encode(
+ y=alt.Y('y:Q', scale=alt.Scale(type='log')),
).properties(title='log base 10')
-chart1 | chart2 | chart3 | chart4
+
+(chart_linear | chart_base_2) & (chart_base_e | chart_base_10)
