Skip to content

Commit

Permalink
update usage example with new syntax and fix 1 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mezarque committed Jun 11, 2024
1 parent 99716fa commit 1712c19
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion arcadia_pycolor/mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def load_colormaps():
# Register the reversed version of the gradient as well.
if isinstance(object, Gradient):
if (colormap_name := f"apc:{object.name}_r") not in colormaps:
plt.register_cmap(name=colormap_name, cmap=object.reversed().to_mpl_cmap())
plt.register_cmap(name=colormap_name, cmap=object.reverse().to_mpl_cmap())


def load_styles():
Expand Down
Binary file modified examples/heatmap_setup.pdf
Binary file not shown.
Binary file modified examples/heatmap_style_axis.pdf
Binary file not shown.
Binary file modified examples/scatter_full_small.pdf
Binary file not shown.
Binary file modified examples/scatter_full_wide.pdf
Binary file not shown.
Binary file modified examples/scatter_half_small.pdf
Binary file not shown.
Binary file modified examples/scatter_setup.pdf
Binary file not shown.
Binary file modified examples/scatter_style_axis.pdf
Binary file not shown.
Binary file modified examples/scatter_threeq_small.pdf
Binary file not shown.
Binary file modified examples/scatter_threeq_wide.pdf
Binary file not shown.
Binary file modified examples/violin_setup.pdf
Binary file not shown.
Binary file modified examples/violin_style_axis.pdf
Binary file not shown.
46 changes: 23 additions & 23 deletions usage_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {},
"outputs": [
{
Expand All @@ -819,12 +819,12 @@
],
"source": [
"print(apc.gradients.viridis)\n",
"print(apc.gradients.viridis.reversed())"
"print(apc.gradients.viridis.reverse())"
]
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand All @@ -839,18 +839,18 @@
"\u001b[48;2;255;255;0m \u001b[0m\u001b[38;2;255;255;0m viridis_5 #ffff00\u001b[0m"
]
},
"execution_count": 19,
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"apc.gradients.viridis.resample(6)"
"apc.gradients.viridis.resample_as_palette(6)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 22,
"metadata": {},
"outputs": [
{
Expand All @@ -865,12 +865,12 @@
}
],
"source": [
"apc.cvd.simulate_color_all(apc.aegean)"
"apc.cvd.display_all_color_deficiencies(apc.aegean)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 23,
"metadata": {},
"outputs": [
{
Expand All @@ -891,18 +891,18 @@
"\u001b[48;2;255;171;172m \u001b[0m\u001b[38;2;255;171;172m tangerine_t #ffabac\u001b[0m"
]
},
"execution_count": 21,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"apc.cvd.simulate_palette(apc.palettes.accent_ordered, \"t\")"
"apc.cvd.simulate_palette_deficiency(apc.palettes.accent_ordered, \"t\")"
]
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 24,
"metadata": {},
"outputs": [
{
Expand All @@ -921,12 +921,12 @@
}
],
"source": [
"apc.cvd.simulate_palette_all(apc.palettes.accent_ordered)"
"apc.cvd.display_all_palette_deficiencies(apc.palettes.accent_ordered)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"outputs": [
{
Expand All @@ -945,12 +945,12 @@
}
],
"source": [
"apc.cvd.simulate_gradient_all(apc.gradients.viridis)"
"apc.cvd.display_all_gradient_deficiencies(apc.gradients.viridis)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"outputs": [
{
Expand All @@ -970,7 +970,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 27,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1005,12 +1005,12 @@
}
],
"source": [
"apc.palettes.display_all()"
"apc.plot.display_all_palettes()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1059,12 +1059,12 @@
}
],
"source": [
"apc.gradients.display_all()"
"apc.plot.display_all_gradients()"
]
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand All @@ -1090,7 +1090,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand All @@ -1106,13 +1106,13 @@
"\u001b[48;2;52;30;96m \u001b[0m\u001b[38;2;52;30;96m concord #341E60\u001b[0m 1.0"
]
},
"execution_count": 28,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"apc.gradients.reds + apc.gradients.blues.reversed()"
"apc.gradients.reds + apc.gradients.blues.reverse()"
]
}
],
Expand Down

0 comments on commit 1712c19

Please sign in to comment.