Category : data-visualization

I have a sample dataframe as given below. import pandas as pd # initialize data of lists. data = {‘ID’:[‘001’, ‘002’, ‘003’, ‘004’, ‘005’], ‘Aim2 Date’:[‘9/3/19’, ‘9/3/19’, ‘9/13/19’, ‘9/20/19’, ‘9/23/19’], ‘Aim2 C/I’ :[‘Intervention’, ‘Intervention’, ‘Intervention’, ‘Control’, ‘Intervention’], ‘Aim3 Date’:[‘9/17/19′,’9/19/19′,’9/27/19′,’9/30/19′,’10/8/19’], ‘Aim3 C/I’ :[‘Control’, ‘Intervention’, ‘Control’, ‘Withdraw’, ‘Withdraw’]} df = pd.DataFrame(data) df The goal is to create ..

Read more

I followed the official docs to create a bar chart along with a line chart on independent axis with dates on the X-axis. Here is the code snippet df = pd.DataFrame({ ‘reportday’: [‘2021-11-08’, ‘2021-11-09’, ‘2021-11-10’, ‘2021-11-11′,’2021-11-12’, ‘2021-11-15′,’2021-11-16’, ‘2021-11-17’, ‘2021-11-18′,’2021-11-19’], ‘price’: [328.0, 310.0, 301.0, 3330.0, 3278.0, 3200.0, 2189.0, 1701.0, 1698.0, 1703.0], ‘production’: [24.75, 16.30, 14.77, 14.10, ..

Read more

I have a visualization I made in Altair and I want to place borders around each label on the y axis (sorry if I am explaining this incorrectly) to separate them. This is the code I have so far: alt.Chart(q4df).transform_fold( rosspaints, as_=[‘column’, ‘value’] ).mark_circle().encode( x = alt.X(‘column:N’, axis=None), y = alt.Y(‘TITLE’, title=None), size = alt.Size(‘value:Q’, ..

Read more

I have a code to plot the Barplot as: fig = plt.figure(figsize = (12,7)) plt.title(f"{symbol} Strike Price vs Put/Call vs {compare_with}",pad = 13, fontweight = ‘heavy’) fig = sns.barplot(x="strike_price", y=’openInterest’, hue="contract_type", data = topn_df, palette = {‘Calls_CE’: ‘tab:green’,’Puts_PE’: ‘tab:red’}, ci = None) for c in fig.containers: fig.bar_label(c, fmt=’%.0f’, label_type=’edge’, padding=5) fig.margins(y=0.3) fig.set_ylabel(compare_with, labelpad = 10, ..

Read more