I am trying to visualization a bar plot of many statistic data, and wanna set y-axis as a integer (there is no float type data in my dataset)
This is one of the charts, which I want to change the axis.
This is my python source code to visualization this chart
def plot_3(data,x,y,width):
selector = alt.selection_single(encodings=['x', 'color'])
bars = alt.Chart(data).mark_bar(opacity=0.8).encode(
alt.X('Tahun:O', title=''),
alt.Y('N:Q', title=x, axis=alt.Axis(format='.0f')), # this format axis has no effect
alt.Column('Keterangan:N', title=y),color=alt.condition(selector, 'Tahun:O', alt.value('lightgray')),
tooltip = ['Tahun','Keterangan','N','Satuan']
).add_selection(selector
).interactive(
).resolve_scale(x='independent')
return bars.properties(width=width
)
waiting for the solution, thank you:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.