Skip to content

Commit

Permalink
use rgbtuple in pyplot for named colors
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Sep 7, 2021
1 parent 4545183 commit 33b1463
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/plutovista.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
# ╔═╡ 412c905f-050c-4b78-a66f-0d03978e7edf
begin
vis=GridVisualizer(resolution=(300,300),Plotter=PlutoVista)
myplot2(t)=scalarplot!(vis,grid,f(t),show=true,flimits=(-π/2/2))
myplot2(t)=scalarplot!(vis,grid,f(t),show=true,clear=true,flimits=(-π/2/2))
end

# ╔═╡ 6f1707ed-79ab-42dc-8ad8-d66a9e1a65b3
Expand Down
2 changes: 1 addition & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ region_cmap(n)=distinguishable_colors(max(5,n),
"""
$(SIGNATURES)
Create custumized distinguishable colormap for boundary regions
Create customized distinguishable colormap for boundary regions
"""
bregion_cmap(n)=distinguishable_colors(max(5,n),
[RGB(1,0,0), RGB(0,1,0), RGB(0,0,1)],
Expand Down
12 changes: 6 additions & 6 deletions src/pyplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,30 +343,30 @@ function scalarplot!(ctx, TP::Type{PyPlotType}, ::Type{Val{1}},grid, func::Abstr
x1=coord[1,i1]
x2=coord[1,i2]
if icell==1
ax.plot([x1,x2],[func[i1],func[i2]],color=ctx[:color],label=ctx[:label])
ax.plot([x1,x2],[func[i1],func[i2]],color=rgbtuple(ctx[:color]),label=ctx[:label])
else
ax.plot([x1,x2],[func[i1],func[i2]],color=ctx[:color])
ax.plot([x1,x2],[func[i1],func[i2]],color=rgbtuple(ctx[:color]))
end
end
else
if ctx[:markershape]==:none
if ctx[:label]!==""
ax.plot(coord[1,:],func,
linestyle=lstyles[ctx[:linestyle]],
color=ctx[:color],
color=rgbtuple(ctx[:color]),
linewidth=ctx[:linewidth],
label=ctx[:label])
else
ax.plot(coord[1,:],func,
linestyle=lstyles[ctx[:linestyle]],
linewidth=ctx[:linewidth],
color=ctx[:color])
color=rgbtuple(ctx[:color]))
end
else
if ctx[:label]!==""
ax.plot(coord[1,:],func,
linestyle=lstyles[ctx[:linestyle]],
color=ctx[:color],
color=rgbtuple(ctx[:color]),
label=ctx[:label],
marker=mshapes[ctx[:markershape]],
markevery=ctx[:markevery],
Expand All @@ -376,7 +376,7 @@ function scalarplot!(ctx, TP::Type{PyPlotType}, ::Type{Val{1}},grid, func::Abstr
else
ax.plot(coord[1,:],func,
linestyle=lstyles[ctx[:linestyle]],
color=ctx[:color],
color=rgbtuple(ctx[:color]),
marker=mshapes[ctx[:markershape]],
markevery=ctx[:markevery],
markersize=ctx[:markersize],
Expand Down

2 comments on commit 33b1463

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 33b1463 Sep 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/44398

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.13 -m "<description of version>" 33b1463d0718df2ae63556da07932e7ef7b73fd2
git push origin v0.2.13

Please sign in to comment.