using PyPlot
plt[:style][:use]("default")
using PyCall
showunlimitedly(x) = show(IOContext(STDOUT, limit=false), "text/plain", x)
showunlimitedly (generic function with 1 method)
plt[:style][:use]("default")
default_prop_cycle = PyDict(matplotlib[:rcParams])["axes.prop_cycle"];
display(default_prop_cycle)
@show default_prop_cycle[:by_key]()["color"]
sleep(0.2)
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
'color' |
---|
'#1f77b4' |
'#ff7f0e' |
'#2ca02c' |
'#d62728' |
'#9467bd' |
'#8c564b' |
'#e377c2' |
'#7f7f7f' |
'#bcbd22' |
'#17becf' |
((default_prop_cycle[:by_key])())["color"] = Any["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
PyObject <matplotlib.legend.Legend object at 0x000000002F0D14E0>
@pyimport cycler as ccl
pc = ccl.cycler("color", ["r", "g", "b", "y"])
display(pc)
@show pc[:by_key]()["color"]
sleep(0.2)
plt[:style][:use]("default")
rc("axes", prop_cycle = pc)
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
'color' |
---|
'r' |
'g' |
'b' |
'y' |
((pc[:by_key])())["color"] = Any["r", "g", "b", "y"]
PyObject <matplotlib.legend.Legend object at 0x000000002F383F98>
@pyimport cycler as ccl
pc = ccl.cycler("color", ["c", "m", "y", "k"])
display(pc)
plt[:style][:use]("default")
rc("axes", prop_cycle = ccl.cycler("color", ["c", "m", "y", "k"]))
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
'color' |
---|
'c' |
'm' |
'y' |
'k' |
PyObject <matplotlib.legend.Legend object at 0x000000002F4968D0>
@pyimport cycler as ccl
stylelist = [
"solid",
"dashed",
"dashdot",
"dotted",
(0, (5, 1.5, 1, 1.5, 1, 1.5, 1, 1.5)),
(0, (5, 1.5, 5, 1.5, 1, 1.5, 1, 1.5)),
(0, (5, 1.5, 5, 1.5, 5, 1.5, 1, 1.5)),
(0, (7, 1.5, 3, 1.5, 3, 1.5, 3, 1.5)),
(0, (7, 1.5, 7, 1.5, 3, 1.5, 3, 1.5)),
(0, (7, 1.5, 7, 1.5, 7, 1.5, 3, 1.5)),
]
pc = ccl.cycler("linestyle", stylelist)
plt[:style][:use]("default")
rc("axes", prop_cycle = pc)
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000032A650F0>
function setpropcycle(colorlist, stylelist)
py"""
import cycler as ccl
pc = ccl.cycler('color', $colorlist)
pc += ccl.cycler('linestyle', $stylelist)
import matplotlib.pyplot as plt
plt.rc("axes", prop_cycle = pc)
"""
end
colorlist = [
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#bcbd22",
"#17becf",
]
stylelist = [
"solid",
"dashed",
"dashdot",
"dotted",
(0, (4.5, 1.5, 1, 1.5, 1, 1.5, 1, 1.5)),
(0, (3, 1.5, 1, 1.5, 3, 1.5, 1, 1.5)),
(0, (2.5, 1.5, 2.5, 1.5, 2.5, 1.5, 1, 1.5)),
(0, (2.5, 1, 2.5, 1, 2.5, 1, 2.5, 1)),
(0, (5, 1.5, 2, 1.5, 2, 1.5)),
(0, (5, 2, 5, 2)),
]
plt[:style][:use]("default")
setpropcycle(colorlist, stylelist)
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000032BA8978>
function setpropcycle(colorlist, stylelist)
py"""
import cycler as ccl
pc = ccl.cycler('color', $colorlist)
pc += ccl.cycler('linestyle', $stylelist)
import matplotlib.pyplot as plt
plt.rc("axes", prop_cycle = pc)
"""
end
colorlist = [
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#bcbd22",
"#17becf",
]
stylelist = [
"solid",
"dashed",
"dashdot",
"dotted",
(0, (4.5, 1.5, 1, 1.5, 1, 1.5, 1, 1.5)),
(0, (3, 1.5, 1, 1.5, 3, 1.5, 1, 1.5)),
(0, (2.5, 1.5, 2.5, 1.5, 2.5, 1.5, 1, 1.5)),
(0, (2.5, 1, 2.5, 1, 2.5, 1, 2.5, 1)),
(0, (5, 1.5, 2, 1.5, 2, 1.5)),
(0, (5, 2, 5, 2)),
]
plt[:style][:use]("default")
rc("font", family="IPAPGothic")
rc("lines", linewidth=1.0)
rc("figure", figsize=(6.4,3.6))
setpropcycle(colorlist, stylelist)
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
title("正弦函数を少しずつずらしてプロット")
xlabel("x 軸")
ylabel("y 軸")
text(0.3, -0.7, "サインカーブたち")
annotate("y=sin(2πx)", xy=(0.1, 0.7), xytext=(0.0,0.95), arrowprops=Dict("arrowstyle" => "->"))
PyObject <matplotlib.text.Annotation object at 0x0000000032C15550>
@pyimport cycler as ccl
colorlist = ["r", "g", "b", "y"]
plt[:style][:use]("default")
figure()
axes()[:set_prop_cycle](ccl.cycler("color", colorlist))
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000032E13160>
colorlist = [
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#bcbd22",
"#17becf",
]
stylelist = [
"solid",
"dashed",
"dashdot",
"dotted",
(0, (4.5, 1.5, 1, 1.5, 1, 1.5, 1, 1.5)),
(0, (3, 1.5, 1, 1.5, 3, 1.5, 1, 1.5)),
(0, (2.5, 1.5, 2.5, 1.5, 2.5, 1.5, 1, 1.5)),
(0, (2.5, 1, 2.5, 1, 2.5, 1, 2.5, 1)),
(0, (5, 1.5, 2, 1.5, 2, 1.5)),
(0, (5, 2, 5, 2)),
]
plt[:style][:use]("default")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i",
color=colorlist[mod1(i+1,length(colorlist))],
linestyle=stylelist[mod1(i+1,length(stylelist))])
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000032D040F0>
plt[:style][:use]("default")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000331462E8>
plt[:style][:use]("default")
plt[:style][:use]("seaborn")
plt[:style][:use]("seaborn-paper")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000342E1080>
plt[:style][:use]("default")
plt[:style][:use]("seaborn")
plt[:style][:use]("seaborn-notebook")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x000000003444E320>
plt[:style][:use]("default")
plt[:style][:use]("seaborn")
plt[:style][:use]("seaborn-poster")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000035560B38>
plt[:style][:use]("default")
plt[:style][:use]("seaborn-white")
plt[:style][:use]("seaborn-deep")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000035660F28>
plt[:style][:use]("default")
plt[:style][:use]("seaborn-darkgrid")
plt[:style][:use]("seaborn-colorblind")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000358407F0>
plt[:style][:use]("default")
plt[:style][:use]("seaborn-pastel")
plt[:style][:use]("seaborn-whitegrid")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000359EC390>
plt[:style][:use]("default")
plt[:style][:use]("bmh")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000035AD8550>
plt[:style][:use]("default")
plt[:style][:use]("dark_background")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x0000000035F5DBA8>
plt[:style][:use]("default")
plt[:style][:use]("fivethirtyeight")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x000000003604AC18>
plt[:style][:use]("default")
plt[:style][:use]("ggplot")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000361822B0>
plt[:style][:use]("default")
plt[:style][:use]("grayscale")
figure()
x = linspace(0,1,101)
for i in 0:10
plot(x, sin.(2pi*x-0.2i), label="$i")
end
legend()
PyObject <matplotlib.legend.Legend object at 0x00000000363C7D30>