matplotlib-basemap

What names can be used in plt.cm.get_cmap?

亡梦爱人 提交于 2020-01-13 12:03:57
问题 I have this code : plt.scatter(data_projected[:,0],data_projected[:,1],c=digits.target ,edgecolors='none',alpha=0.5,cmap=plt.cm.get_cmap('nipy_spectral',10)); My confusion comes from plt.cm.get_cmap('nipy_spectral',10) . Sometimes there will be plt.cm.get_cmap('RdYlBu') instead. Is the 'RdYlBu' , 'nipy_spectral' the name of a color? And is there any other names to use instead? Is there a list of all colors available? I have read the document but it does not seem to help or I do not understand

What names can be used in plt.cm.get_cmap?

≯℡__Kan透↙ 提交于 2020-01-13 12:03:27
问题 I have this code : plt.scatter(data_projected[:,0],data_projected[:,1],c=digits.target ,edgecolors='none',alpha=0.5,cmap=plt.cm.get_cmap('nipy_spectral',10)); My confusion comes from plt.cm.get_cmap('nipy_spectral',10) . Sometimes there will be plt.cm.get_cmap('RdYlBu') instead. Is the 'RdYlBu' , 'nipy_spectral' the name of a color? And is there any other names to use instead? Is there a list of all colors available? I have read the document but it does not seem to help or I do not understand

How can I avoid PROJ_LIB error in importing basemap?

偶尔善良 提交于 2020-01-13 11:09:14
问题 I tried to import basemap as follows in Python: from mpl_toolkits.basemap import Basemap and I get the following error: Traceback (most recent call last): File "<ipython-input-16-880204a64918>", line 2, in <module> from mpl_toolkits.basemap import Basemap File "C:\Users\bakhadher\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 155, in <module> pyproj_datadir = os.environ['PROJ_LIB'] File "C:\Users\bakhadher\AppData\Local\Continuum\anaconda3\lib\os

How can I avoid PROJ_LIB error in importing basemap?

故事扮演 提交于 2020-01-13 11:09:08
问题 I tried to import basemap as follows in Python: from mpl_toolkits.basemap import Basemap and I get the following error: Traceback (most recent call last): File "<ipython-input-16-880204a64918>", line 2, in <module> from mpl_toolkits.basemap import Basemap File "C:\Users\bakhadher\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 155, in <module> pyproj_datadir = os.environ['PROJ_LIB'] File "C:\Users\bakhadher\AppData\Local\Continuum\anaconda3\lib\os

ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

二次信任 提交于 2020-01-06 09:05:24
问题 I have trouble importing the basemap module of mpl_toolkits in python. I've got following error message when I try to run "from mpl_toolkits.basemap import Basemap": ModuleNotFoundError: No module named 'mpl_toolkits.basemap' I'm using python 3.6.5 in windows. I've found relevant Q&A in "Python basemap module impossible to import" and I already followed what's instructed there (i.e. source activate MyProfileName, conda install basemap) but it didn't work. The clue might already be given in

Matplotlib: Inset plot within Basemap

筅森魡賤 提交于 2020-01-06 07:58:49
问题 I'm attempting to inset a line graph within the lower right-hand corner of a Basemap plot, but the code I'm using (based off the Matplotlib documentation) is not working for me, probably because it includes no Basemap arguments. Instead, I keep getting a figure that looks like this: Below is the code I've used to try and create my figure. Any help on getting the line graph inside the graph would be extremely helpful. Thanks in advance! fig = plt.figure(figsize=(10,8)) ax = fig.add_subplot(121

Matplotlib Mollweide/Hammer projection: region of interest only

て烟熏妆下的殇ゞ 提交于 2020-01-06 01:16:53
问题 I was wondering if there's a way to only show the region of interest from a plot based on Mollweide/Hammer projection in basemap (matplotlib). I am trying to set the plot-bounds roughly to the Pacific plate, as in the link below. However, the set_xlim and set_ylim functions do not seem to have any effect. Thanks in advance for any guidance. http://geology.gsapubs.org/content/29/8/695/F1.large.jpg 回答1: From the documentation, both Hammer and Mollweide projections don't allow this as they print

Shade states of a country according to dictionary values with Basemap

▼魔方 西西 提交于 2020-01-02 18:52:47
问题 I want to plot the map of Mexico and shade the states accordingly to a the values of a dictionary. I used the following code suggested in previous question (Easiest way to plot data on country map with python), so far it plots the country and states, but when I try to define the shading I get an error. Below the code: import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection from mpl_toolkits.basemap import Basemap %matplotlib inline from shapely

Scipy map_coordinates bilinear interpolation compared to interp and IDL interpolate

让人想犯罪 __ 提交于 2020-01-02 04:10:14
问题 I'm in the process of rewriting a coworkers IDL code into python and am coming up with some differences that I'm confused about. According to other SO questions and mailing list threads I've found if you use scipy.ndimage.interpolation.map_coordinates and specify order=1 it is supposed to do bilinear interpolation. When comparing results between the IDL code (run in GDL) and python (map_coordinates) I got different results. Then I tried using mpl_toolkits.basemap.interp and I got the same

Basemap won't import because 'epsg' file or directory can't be found (MacOS, Anaconda, Jupyter Notebook)

可紊 提交于 2020-01-01 22:29:11
问题 I am trying to use the Matplotlib Basemap toolkit but am running into a FileNotFoundError related to epsg when I try importing it. I installed it using the following command: conda install -c conda-forge basemap Here's my import command: from mpl_toolkits.basemap import Basemap Here's the error: --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-1-d9467465a3b6> in <module> ----> 1 from mpl_toolkits