-
Notifications
You must be signed in to change notification settings - Fork 372
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
Comments
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() |
Thanks. However, I think I need to rely on For example, if we shift that circle over:
|
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() |
Thanks for that workaround. |
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 |
That is a nice compact workaround so is the one I will implement for now. Thanks. |
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: