Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fig.legend() method ignores fill color option #396

Closed
firstkingofrome opened this issue Feb 19, 2020 · 4 comments
Closed

fig.legend() method ignores fill color option #396

firstkingofrome opened this issue Feb 19, 2020 · 4 comments

Comments

@firstkingofrome
Copy link

Hello, when I try and make a legend using the fig.legend() option the fill color is ignored (I attached a simple script below that causes the problem, given that I specify F="+gred" I expect that background of the legend to be filled with red, however no fill is applied).

Thank You for helping me to resolve this issue!

import pygmt as gmt
REGION = "0/100/0/40"
SCALE = "7.5i/-5i"
buildingLocations = {"Location54":(12.000,50.000),"Location17":(18.000,52.000)}

fig = gmt.Figure()
#fig.grdimage(grid="temp.grd",R=REGION,frame=True)
fig.plot(x=buildingLocations["Location54"][1],y=buildingLocations["Location54"][0],
R=REGION,style="s0.5",color="yellow",pen="thin,black",label="Location54")

fig.plot(x=buildingLocations["Location17"][1],y=buildingLocations["Location17"][0],
R=REGION,style="s0.5",color="white",pen="thin,black",label="Location17")

fig.legend(F="+gred",position="JTR+jTR+o0.2c", box=True)

fig.show()

@welcome
Copy link

welcome bot commented Feb 19, 2020

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

@firstkingofrome firstkingofrome changed the title fig.legend() does ignores fill color option fig.legend() method ignores fill color option Feb 19, 2020
@firstkingofrome
Copy link
Author

I forgot to specify, I am using version '0.0.1a0+69.g320a728'

@seisman
Copy link
Member

seisman commented Feb 19, 2020

Argument box is the more readable alias of -F option in the command line. So your command is equivalent to command gmt legend -F -F+gred.

The code below should work.

fig.legend(position="JTR+jTR+o0.2c", box="+gred")

@firstkingofrome
Copy link
Author

Thank You, that worked (I did not know about that syntax!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants