简体   繁体   中英

Some Altair charts fade

Updated: Changing alt.X('yearmonthdate(TimeUTC):T' to alt.X('yearmonthdate(TimeUTC):O' made the problem go away. See bottom of post.

I have four years of data of the form:

TimeUTC FlightID DroneType
2018-08-22 19:35:23.024386+00:00 2018-08-22 19:35:23+00:00 663f-46fe-8887-d37895745506 MavicPro
2018-08-22 19:35:35.888933+00:00 2018-08-22 19:35:35+00:00 663f-46fe-8887-d37895745506 MavicPro
2018-08-22 20:05:06.239102+00:00 2018-08-22 20:05:06+00:00 a63a-4e01-b2d2-bdecc9027049 MavicPro

(There is, I think, a good reason for the microseconds in the index AND the TimeUTC column, but that is for another day.)

I plot this data by year. One set of graphs using mark_bar is produced as expected. Two of the four mark_area charts are very faded and a third is somewhat faded.

一张“好”的图表

一张非常褪色的图表

有点褪色的图表

    chart = alt.Chart(chart_df).mark_area().encode(
        alt.X('month(TimeUTC):O', title='Month',axis=alt.AxisConfig(labelAngle=45)), 
        alt.Y('distinct(FlightID)', type='quantitative', title='Number of sUAS Operations'),
        alt.Color('DroneType', 
            type='nominal', 
            legend=alt.Legend(orient="bottom", columns=4), 
        scale=alt.Scale(domain=_domain, range=_range_))
    ).properties(
            title='Distribution of sUAS Flights by Model Over Time (Fig. 11)',
            width=400,
            height=200
        )

    chart.configure_title(
        fontSize=20,
        font='Courier',
        anchor='start',
        color='gray'
    )

All the charts use the same function and the data from the same data frame.

What might be causing this fade effect and how can I fix it?

Updated:

Original problem chart created with alt.X('yearmonthdate(TimeUTC):T' :

图表使用:T

Chart using alt.X('yearmonthdate(TimeUTC):O' :

图表:O

The fix, such as it is, required changing:

alt.X('yearmonthdate(TimeUTC):T

to

alt.X('yearmonthdate(TimeUTC):O

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM