Skip to content
Snippets Groups Projects
Commit 20055009 authored by Maxence Larrieu's avatar Maxence Larrieu
Browse files

update color set

parent a26d71f5
No related branches found
No related tags found
No related merge requests found
2-produce-graph/pie--datacite-type.png

54.2 KiB | W: | H:

2-produce-graph/pie--datacite-type.png

55 KiB | W: | H:

2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -17,7 +17,7 @@ df_type = df["resourceTypeGeneral"].value_counts()
#define a color palette to use
### see color palett https://matplotlib.org/stable/users/explain/colors/colormaps.html
colors = [plt.cm.Pastel1(i) for i in range(len(df_type))]
colors = [plt.cm.tab20(i) for i in range(len(df_type))]
random.shuffle(colors) ## so that blue is not more the first item
plt.subplots(figsize=(10, 7))
......@@ -25,7 +25,7 @@ plt.subplots(figsize=(10, 7))
plt.pie(df_type, colors = colors, autopct=lambda p: '{:.0f}%'.format(round(p)) if p > 1 else '', startangle = 160)
## auto pct only if value > 1
plt.legend(df_type.index, loc = (0.85, 0.2) )
plt.legend(df_type.index, loc = (0.80, 0.2), framealpha = 0.95)
plt.title(f"Type of datasets", fontsize = 20, x = 0.5, y = 1.03, alpha = 0.6)
plt.suptitle(f"n = {len(df)}", fontsize = 11, x = 0.5, y = 0.9, alpha = 0.6)
......@@ -33,6 +33,6 @@ plt.tight_layout(h_pad = 0)
plt.savefig("pie--datacite-type.png")
print(f"\ngraph produced pie--datacite-type.png")
plt.show()
# plt.show()
# print(len(df))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment