![]() ![]() fig, (ax, ax_leg) = plt.subplots(2, figsize=(12,10), gridspec_kw=) # Plot lines for the average sns.scatterplot(y="Unit", x="Quality Score", data=df_unit, marker='|', s=1000, color='k', ax=ax) # Jitter plot sns.stripplot(y="Unit", x="Quality Score", data=df, order=order, zorder=0, ax=ax) # custom Legend legend_elements =, , marker='o', color='w', label='One test result', markerfacecolor='k', markersize=10), Line2D(,, marker='|', color='k', label='Mean quality score for the unit', linestyle='None', markersize=25)] legend = ax_leg.legend(handles=legend_elements, loc='upper center', ncol=2, frameon=False, fontsize=12) ax_leg.set_xticks() ax_leg.set_yticks() # remove spines sns.despine(fig, left=True, top=True, right=True, bottom=True) # title and labels ax.set_title('Quality score by production unit\n', loc='left', fontsize=20) ax.set_xlabel('') ax.set_ylabel('') # make it tight (: plt.tight_layout() plt. Creating Scatter Plots in Python Using plt.scatter() In this video, we will be learning how to create scatter plots in Matplotlib.This video is sponsored by Brilliant. Here is an example of how to use Matplotlib in Python: import matplotlib.pyplot as plt Data x. The scatter () function plots one dot for each observation. you can make different sizes in one figure as well, use slices in that case: gs gridspec.GridSpec (3, 3) ax1 plt.subplot (gs 0,:) row 0 (top) spans all (3) columns. ![]() Alright! Everything seems to be in place. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |