-
Notifications
You must be signed in to change notification settings - Fork 359
-
Star 1.4k
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
data color is adopted as additional map border color #1133
data color is adopted as additional map border color #1133
Comments
ajdawson
commented
Sep 27, 2018
This is not the case if you specify the coordinate system as import matplotlib.pyplot as plt
import cartopy.crs as ccrs
x = [-149.99, -143.82, -140.38, -140.40, -143.15, -147.54, -152.45, -156.84, -159.59, -159.61, -156.17, -149.99, -149.99]
y = [64.99, 64.07, 61.74, 58.93, 56.53, 55.17, 55.17, 56.53, 58.93, 61.74, 64.07, 64.99, 64.99]
fig = plt.figure(figsize=(8,8))
map_projection = ccrs.Orthographic(central_longitude=200,central_latitude=30)
ax = plt.axes(projection = map_projection)
plt.plot(x, y, color='red', transform=ccrs.PlateCarree())
ax.set_global()
plt.show()
|
Swanson-Hysell
commented
Sep 27, 2018
Thanks. However, I think I need to rely on For example, if we shift that circle over:
|
ajdawson
commented
Sep 27, 2018
Yeah sorry, my comment was intended as of a point of interest for debugging rather than a solution. I'm not sure what is wrong, I tried applying the transform manually to see if there are any weird values, but it actually does what is expected, which would be a suitable workaround for you right now (works for both cases provided). It would be good to get to the bottom of why this happens still though. import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np
x = [-149.99, -143.82, -140.38, -140.40, -143.15, -147.54, -152.45, -156.84, -159.59, -159.61, -156.17, -149.99, -149.99]
y = [64.99, 64.07, 61.74, 58.93, 56.53, 55.17, 55.17, 56.53, 58.93, 61.74, 64.07, 64.99, 64.99]
fig = plt.figure(figsize=(8,8))
map_projection = ccrs.Orthographic(central_longitude=200,central_latitude=30)
p = map_projection.transform_points(
ccrs.Geodetic(),
np.array(x),
np.array(y),
)
ax = plt.axes(projection = map_projection)
ax.plot(p[:, 0], p[:, 1], color='red', transform=map_projection)
ax.set_global()
plt.show() |
Swanson-Hysell
commented
Sep 27, 2018
Thanks for that workaround. |
QuLogic
commented
Sep 27, 2018
The "problem" is that your polygon is in the wrong order, i.e., the small portion is outside the polygon and most of the globe is inside. Another workaround is to reverse the order: ax.set_global()
ax.plot(x[::-1], y[::-1], color='red', transform=ccrs.Geodetic()) That being said, I don't think |
Swanson-Hysell
commented
Sep 27, 2018
That is a nice compact workaround so is the one I will implement for now. Thanks. |
QuLogic
commented
Oct 7, 2018
Closing as duplicate of #1078. |
Description
When plotting a small circle in cartopy, I am getting an issue where the color of that plotted data is also being adopted around the entire map as in this image where red can be seen in addition to the black outline:
Code to reproduce
Full environment definition
Operating system
Mac OS 10.13.16
Cartopy version
cartopy 0.16.0 py36h81b52dc_2 conda-forge
conda list
pip list
The text was updated successfully, but these errors were encountered: