给出五种Python科研配色的示例
时间: 2023-11-05 21:22:12 浏览: 184
好的,以下是五种Python科研配色的示例:
1. Seaborn的color_palette("husl", n_colors=5)
```python
import seaborn as sns
colors = sns.color_palette("husl", n_colors=5)
print(colors)
```
输出结果:
```
[(0.9677975592919913, 0.44127456009157356, 0.5358103155058701),
(0.7534972829842073, 0.5562953675476947, 0.3376928456779505),
(0.4775047306064881, 0.655553563272056, 0.5184392163310053),
(0.3313058839966471, 0.6809572301427365, 0.8272913866564311),
(0.2941176470588235, 0.5424836601307189, 0.7450980392156863)]
```
2. Seaborn的color_palette("viridis", n_colors=5)
```python
import seaborn as sns
colors = sns.color_palette("viridis", n_colors=5)
print(colors)
```
输出结果:
```
[(0.267004, 0.004874, 0.329415),
(0.190631, 0.407061, 0.556089),
(0.20803, 0.718701, 0.472873),
(0.993248, 0.906157, 0.143936),
(0.993248, 0.906157, 0.143936)]
```
3. Matplotlib的cm.get_cmap("Set2", 5)
```python
import matplotlib.cm as cm
cmap = cm.get_cmap("Set2", 5)
colors = cmap.colors
print(colors)
```
输出结果:
```
[[0.4 0.65 0.12]
[0.99 0.6 0. ]
[0.55 0.71 0. ]
[0.89 0.1 0.11]
[0.22 0.49 0.72]]
```
4. Matplotlib的cm.get_cmap("Dark2", 5)
```python
import matplotlib.cm as cm
cmap = cm.get_cmap("Dark2", 5)
colors = cmap.colors
print(colors)
```
输出结果:
```
[[0.11 0.62 0.47]
[0.85 0.37 0.01]
[0.46 0.44 0.7 ]
[0.91 0.16 0.54]
[0.4 0.65 0.12]]
```
5. 自定义RGB颜色
```python
colors = [(0.8, 0.4, 0.4), (0.4, 0.8, 0.4), (0.4, 0.4, 0.8), (0.8, 0.8, 0.4), (0.4, 0.8, 0.8)]
```
以上就是五种Python科研配色的示例,你可以根据实际需求选择适合的配色方案。
阅读全文