I found some issue, maybe a bug in mplcursors library. Because already done the reproducable code, put this below:
import matplotlib.pyplot as plt
import mplcursors
import numpy as np
import pandas as pd
N = 30
n = [int(i) for i in range(0,N)]
x = np.random.random(N)*10
y = np.random.random(N)*10
z = np.random.random(N)*10
df = pd.DataFrame(data = np.array([n, x, y, z]).T, columns = ['id', 'X', 'Y', 'Z'])
fig = plt.figure(frameon=False, facecolor='yellow', edgecolor='green', dpi=200, figsize=(8,5))
ax = fig.gca(projection='3d')
points = ax.scatter3D(x, y, z, s=5, marker='o', edgecolor='black', linewidth=.5)
def getInfo(sel):
n,x,y,z = df.loc[sel, ['id', 'X', 'Y', 'Z']]
row = "Point: " + str(n) + "\n" + str(x) + ", \n" + str(y) + ", \n" + str(z)
return row
ap = [{'horizontalalignment': 'left', 'verticalalignment': 'top', 'anncoords': 'offset points'}] #, 'position': (8, -8)}]
mc = mplcursors.cursor(points, hover=2, annotation_positions=ap)
mc.connect("add", lambda sel: sel.annotation.set_text( getInfo(sel.index) ))
mc.connect("add", lambda sel: sel.annotation.get_bbox_patch().set(fc="palegreen", alpha=0.75))
plt.show()
The error message is here:
Traceback (most recent call last):
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 196, in process
func(*args, **kwargs)
File "C:\Users\cp\Anaconda3\lib\site-packages\mplcursors\_mplcursors.py", line 567, in _on_hover_motion_notify
self._on_select_event(event)
File "C:\Users\cp\Anaconda3\lib\site-packages\mplcursors\_mplcursors.py", line 615, in _on_select_event
self.add_selection(pi)
File "C:\Users\cp\Anaconda3\lib\site-packages\mplcursors\_mplcursors.py", line 412, in add_selection
bbox = ann.get_window_extent(renderer)
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\text.py", line 2403, in get_window_extent
bboxes.append(self.arrow_patch.get_window_extent())
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\patches.py", line 609, in get_window_extent
return self.get_path().get_extents(self.get_transform())
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\patches.py", line 4218, in get_path
_path, fillable = self.get_path_in_displaycoord()
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\patches.py", line 4238, in get_path_in_displaycoord
shrinkB=self.shrinkB * dpi_cor
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\patches.py", line 2775, in __call__
clipped_path = self._clip(path, patchA, patchB)
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\patches.py", line 2728, in _clip
left, right = split_path_inout(path, insideA)
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py", line 296, in wrapper
return func(*args, **kwargs)
File "C:\Users\cp\Anaconda3\lib\site-packages\matplotlib\bezier.py", line 274, in split_path_inout
ctl_points, command = next(path_iter)
StopIteration
The issue is in the line:
ap = [{'horizontalalignment': 'left', 'verticalalignment': 'top',
'anncoords': 'offset points'}] #, 'position': (8, -8)}]
Everything works if I either skip the ap variable, or add position variable to the list. No other way round. The drawback for this is that I can't justify the text without ap and the position of hover is not selecting automatically - when the ap is assigned.
If anyone knows the solution to have justification without manually positioning the hoverbox please answer, however it's minor issue at the end.
Related
Here is the error
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 224, in process
func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/animation.py", line 959, in _start
self._init_draw()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/animation.py", line 1703, in _init_draw
self._draw_frame(next(self.new_frame_seq()))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/animation.py", line 1726, in _draw_frame
self._drawn_artists = self._func(framedata, *self._args)
File "/Users/lkhagvabyambajav/Desktop/rplidar/examples/animate.py", line 14, in update_line
scan = next(iterator)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/rplidar.py", line 357, in iter_scans
for new_scan, quality, angle, distance in iterator:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/rplidar.py", line 323, in iter_measurments
raw = self._read_response(dsize)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/rplidar.py", line 199, in _read_response
raise RPLidarException('Wrong body size')
rplidar.RPLidarException: Wrong body size
and code is
from rplidar import RPLidar
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
PORT_NAME = '/dev/tty.usbserial-0001'
DMAX = 4000
IMIN = 0
IMAX = 50
def update_line(num, iterator, line):
scan = next(iterator)
offsets = np.array([(np.radians(meas[1]), meas[2]) for meas in scan])
line.set_offsets(offsets)
intens = np.array([meas[0] for meas in scan])
line.set_array(intens)
return line,
def run():
lidar = RPLidar(PORT_NAME)
fig = plt.figure()
ax = plt.subplot(111, projection='polar')
line = ax.scatter([0, 0], [0, 0], s=5, c=[IMIN, IMAX],
cmap=plt.cm.Greys_r, lw=0)
ax.set_rmax(DMAX)
ax.grid(True)
iterator = lidar.iter_scans()
ani = animation.FuncAnimation(fig, update_line,
fargs=(iterator, line), interval=50)
plt.show()
lidar.stop()
lidar.disconnect()
if __name__ == '__main__':
run()
I didnt write this code it is from https://github.com/SkoltechRobotics/rplidar
Im trying to test my lidar to see if it is working.
Any help will be appreciated. Many thanks :)
i'm using python 2.7 and Lidar A1M8 ('hardware': 7, 'model': 24, 'firmware': (1, 29)) to run it and it works with no errors.
So i think you should take a look at the RPlidar library and the lidar version which is supported, i've seen an issue about that constraint. Try to use another library like pylidar2.
there is the issue : https://github.com/SkoltechRobotics/rplidar/issues/36#issuecomment-787215840,
take a look at https://github.com/Roboticia/RPLidar
I am writing a Mandelbrot set generator with Numba/Numpy. One of the optimizations is to use cudatoolkit to push calculations to CUDA through Numba. The script works for low resolution sets, however it gives an error when trying to calculate large sets.
import numpy as np
from pylab import imshow, show
import time
from numba import cuda
from numba import *
import matplotlib
def mandel(x, y, max_iters):
c = complex(x, y)
z = 0.0j
for i in range(max_iters):
z = z*z + c
if (z.real*z.real + z.imag*z.imag) >= 4:
return i
return max_iters
mandel_gpu = cuda.jit(device=True)(mandel)
#cuda.jit
def mandel_kernel(min_x, max_x, min_y, max_y, image, iters):
height = image.shape[0]
width = image.shape[1]
pixel_size_x = (max_x - min_x) / width
pixel_size_y = (max_y - min_y) / height
startX, startY = cuda.grid(2)
gridX = cuda.gridDim.x * cuda.blockDim.x;
gridY = cuda.gridDim.y * cuda.blockDim.y;
for x in range(startX, width, gridX):
real = min_x + x * pixel_size_x
for y in range(startY, height, gridY):
imag = min_y + y * pixel_size_y
image[y, x] = mandel_gpu(real, imag, iters) / iters
gimage = np.zeros((65536, 65536), dtype = np.uint8)
#gimage = np.zeros((1024, 1024), dtype = np.uint8)
blockdim = (32, 8)
griddim = (32,16)
start = time.time()
d_image = cuda.to_device(gimage)
mandel_kernel[griddim, blockdim](-2.0, 2.0, -2.0, 2.0, d_image, 10000)
d_image.to_host()
dt = time.time() - start
print ("Mandelbrot created in " + str(dt) + " seconds")
imshow(gimage, 'gray')
show()
#matplotlib.image.imsave("mandel.png", gimage)
Above 46000 by 46000 pixels, python raises the following error:
Traceback (most recent call last):
File "C:\_main\Files\Mandel\mandel_cuda.py", line 46, in <module>
d_image = cuda.to_device(gimage)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 212, in _require_cuda_context
return fn(*args, **kws)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\api.py", line 103, in to_device
to, new = devicearray.auto_device(obj, stream=stream, copy=copy)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 688, in auto_device
devobj.copy_to_device(obj, stream=stream)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 212, in _require_cuda_context
return fn(*args, **kws)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 181, in copy_to_device
sentry_contiguous(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 657, in sentry_contiguous
core = array_core(ary)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 647, in array_core
return ary[tuple(core_index)]
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 212, in _require_cuda_context
return fn(*args, **kws)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 479, in __getitem__
return self._do_getitem(item)
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 493, in _do_getitem
newdata = self.gpu_data.view(*extents[0])
File "C:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\driver.py", line 1227, in view
raise RuntimeError("non-empty slice into empty slice")
RuntimeError: non-empty slice into empty slice
The script was run on a 1050ti with 4GB VRAM. For 46000 by 46000 pixels, the VRAM usage is only at 2.1GB. There should be plenty of VRAM for renders above 46000 by 46000.
It seems that it is a VRAM overflow issue. For the first 30 seconds of the render, more VRAM is used to store the empty set. When initializing, the 4GB limit is quickly reached, crashing the script.
enter image description hereI'm learning how to using python to draw some 3D pictures.
When I typing plt.show(), there will be an error.
ValueError: max() arg is an empty sequence
However, I have tried run it on IDLE and it didn't have an error.
What should I do to fix this problem when using PyCharm, really appreciate for helping.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x = np.linspace(-6 * np.pi, 6 * np.pi, 1000)
y = np.sin(x)
z = np.cos(x)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot(x, y, z)
plt.show()
I tried it in Python Console, only when I run plt.show() there will be an error.
[<mpl_toolkits.mplot3d.art3d.Line3D at 0x111b09c88>]
plt.show()
/Users/harry./Library/Python/3.6/lib/python/site-packages/matplotlib/figure.py:1743: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
warnings.warn("This figure includes Axes that are not "
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-1eb00ff78cf2>", line 1, in <module>
plt.show()
File "/Users/harry./Library/Python/3.6/lib/python/site-packages/matplotlib/pyplot.py", line 253, in show
return _show(*args, **kw)
File "/Applications/PyCharm.app/Contents/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 27, in __call__
manager.show(**kwargs)
File "/Applications/PyCharm.app/Contents/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 99, in show
self.canvas.show()
File "/Applications/PyCharm.app/Contents/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 64, in show
self.figure.tight_layout()
File "/Users/harry./Library/Python/3.6/lib/python/site-packages/matplotlib/figure.py", line 1753, in tight_layout
rect=rect)
File "/Users/harry./Library/Python/3.6/lib/python/site-packages/matplotlib/tight_layout.py", line 326, in get_tight_layout_figure
max_nrows = max(nrows_list)
ValueError: max() arg is an empty sequence
I am using a model where the mean response depends on the solution to an ODE. I am trying to fit this model using pymc3, but am running into problems (relating to missing test values) when joining the ODE solver to the model.
Model
y_t is Lognormally distributed with mean mu_t and standard deviation sigma.
mu_t is the solution to a set of ODE's at time t.
Problem
Theano/ pymc3 gives an error because the theano tensor variables used in solving the ODE have no test values. See below for a copy of the errors. I've tried setting
th.config.compute_test_value = 'ignore'
but I think that pymc3 changes it back to require test values. I am fairly new to theano and pymc3, so I apologise if I am missing something obvious.
Code
Imports
import pymc3 as pm
import theano as th
import theano.tensor as tt
from FormatData import *
import pandas as pd
Functions to solve ODE
# Runge Kutta integrator
def rungekuttastep(h, y, fprime, *args):
k1 = h*fprime(y, *args)
k2 = h*fprime(y + 0.5*k1, *args)
k3 = h*fprime(y + 0.5*k2, *args)
k4 = h*fprime(y + k3, *args)
y_np1 = y + (1./6.)*k1 + (1./3.)*k2 + (1./3.)*k3 + (1./6.)*k4
return y_np1
# ODE equations for my model
def ODE(y, *args):
alpha = args
yprime = tt.zeros_like(y)
yprime = tt.set_subtensor(yprime[0], alpha[0]*y[1] - alpha[1]*y[0])
yprime = tt.set_subtensor(yprime[1], -alpha[2]*y[0]*y[1])
return yprime
# Function to return ODE values given parameters
def calcFittedTitreVals(alpha, niter, hsize, inits):
y0 = tt.vector('y0')
h = tt.scalar('h')
i = tt.iscalar('i')
alpha0 = tt.scalar('alpha0')
alpha1 = tt.scalar('alpha1')
alpha2 = tt.scalar('alpha2')
result, updates = th.scan(fn=lambda y0, h: rungekuttastep(h, y0, ODE, alpha0, alpha1, alpha2),
outputs_info=[{'initial': y0}], non_sequences=h, n_steps=i)
odeint = th.function(inputs=[h, y0, i, alpha0, alpha1, alpha2], outputs=result, updates=updates)
z1 = odeint(h=hsize, # size of the interval
y0=inits, # starting values
i=niter, # number of iterations
alpha0=alpha[0], alpha1=alpha[1], alpha2=alpha[2])
C = z1[:, 0]
A = z1[:, 1]
return C, A
Generate Data
t = np.arange(0, 45, 0.1) # times at which to solve ODE
alpha = np.array([2, 0.4, 0.0001]) # true paramter values ODE
C, A = calcFittedTitreVals(alpha, niter=450, hsize=0.1, inits=[0, 1200])
td = np.arange(0, 45, 1) # times at which I observe data
sigma = 0.1
indices = np.array(np.searchsorted(t, td)).flatten()
DATA = pd.DataFrame(
data={'observed': np.random.lognormal(np.log(C[indices]), sigma),
'true': C[indices], 'time': td})
pymc3 model function
def titreLogNormal(Y, hsize, inits, times):
Y = th.shared(Y)
inits = th.shared(inits)
timesG = np.arange(0, 45, step=hsize)
indices = np.array(np.searchsorted(timesG, times)).flatten()
nTsteps = th.shared(timesG.shape[0])
hsize = th.shared(hsize)
y0 = tt.vector('y0')
h = tt.scalar('h')
i = tt.iscalar('i')
alpha0 = tt.scalar('alpha0')
alpha1 = tt.scalar('alpha1')
alpha2 = tt.scalar('alpha2')
result, updates = th.scan(fn=lambda y0, h: rungekuttastep(h, y0, ODE, alpha0, alpha1, alpha2),
outputs_info=[{'initial': y0}], non_sequences=h, n_steps=i)
odeint = th.function(inputs=[h, y0, i, alpha0, alpha1, alpha2], outputs=result, updates=updates)
model = pm.Model()
with model:
alpha = pm.Gamma('alpha', 0., 10., shape=3, testval=[2, 0.4, 0.001])
sigma = pm.Gamma('sigma', 0.1, 0.1, testval=0.1)
res = odeint(h=hsize, y=inits, i=nTsteps, alpha0=alpha[0], alpha1=alpha[1], alpha2=alpha[2])
mu = pm.Deterministic("mu", res[indices, 0])
y = pm.Lognormal('y', mu, sigma, observed=Y)
return model
Create model with data
model = titreLogNormal(
Y=np.array(DATA[['observed']]).flatten(),
hsize=0.1, inits={'a': 0, 'p': 1200},
times=np.array(DATA[['time']]).flatten())
Errors
Traceback (most recent call last):
File "/home/millerp/.local/lib/python3.5/site-packages/theano/gof/op.py", line 625, in __call__
storage_map[ins] = [self._get_test_value(ins)]
File "/home/millerp/.local/lib/python3.5/site-packages/theano/gof/op.py", line 581, in _get_test_value
raise AttributeError('%s has no test value %s' % (v, detailed_err_msg))
AttributeError: y0 has no test value
Backtrace when that variable is created:
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 251, in add_exec
more = self.do_add_exec(code_fragment)
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 41, in do_add_exec
res = bool(self.interpreter.add_exec(codeFragment.text))
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 455, in add_exec
self.ipython.run_cell(line, store_history=True)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2821, in run_ast_nodes
if self.run_code(code, result):
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-54c976fefe1e>", line 99, in <module>
times=np.array(DATA[['time']]).flatten()
File "<ipython-input-2-54c976fefe1e>", line 71, in titreLogNormal
y0 = tt.vector('y0')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-54c976fefe1e>", line 99, in <module>
times=np.array(DATA[['time']]).flatten()
File "<ipython-input-2-54c976fefe1e>", line 86, in titreLogNormal
outputs_info=[{'initial': y0}], non_sequences=h, n_steps=i)
File "/home/millerp/.local/lib/python3.5/site-packages/theano/scan_module/scan.py", line 660, in scan
tensor.shape_padleft(actual_arg), 0),
File "/home/millerp/.local/lib/python3.5/site-packages/theano/tensor/basic.py", line 4429, in shape_padleft
return DimShuffle(_t.broadcastable, pattern)(_t)
File "/home/millerp/.local/lib/python3.5/site-packages/theano/gof/op.py", line 639, in __call__
(i, ins, node, detailed_err_msg))
ValueError: Cannot compute test value: input 0 (y0) of Op InplaceDimShuffle{x,0}(y0) missing default value.
Backtrace when that variable is created:
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 251, in add_exec
more = self.do_add_exec(code_fragment)
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 41, in do_add_exec
res = bool(self.interpreter.add_exec(codeFragment.text))
File "/home/millerp/pycharm/pycharm-edu-3.5.1/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 455, in add_exec
self.ipython.run_cell(line, store_history=True)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2821, in run_ast_nodes
if self.run_code(code, result):
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-54c976fefe1e>", line 99, in <module>
times=np.array(DATA[['time']]).flatten()
File "<ipython-input-2-54c976fefe1e>", line 71, in titreLogNormal
y0 = tt.vector('y0')
I'm trying to display a circle of fixed size in a leaflet map.
I tried with .add_artist()(see here) and I'm now trying with .add_patch()
import mplleaflet
import matplotlib.pyplot as plt
import matplotlib as mpl
fig, ax = plt.subplots()
x = 2.363561
y = 48.951918
r = 20
circle1 = mpl.patches.Circle((x,y), radius=r)
circle2= plt.Circle((x, y), r, color='r')
#ax.add_patch(circle1)
#ax.add_patch(circle2)
mplleaflet.show(fig=ax.figure)
You can try to uncomment one of the two commented lines, it doesn't matter which line is uncommented, same error pops.
Here is the trace I get :
Traceback (most recent call last):
File "<ipython-input-81-1fdd7f4a9d12>", line 16, in <module>
mplleaflet.show(fig = ax.figure)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\_display.py", line 180, in show
save_html(fig, fileobj=f, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\_display.py", line 131, in save_html
html = fig_to_html(fig, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\_display.py", line 84, in fig_to_html
exporter.run(fig)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\mplexporter\exporter.py", line 51, in run
self.crawl_fig(fig)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\mplexporter\exporter.py", line 118, in crawl_fig
self.crawl_ax(ax)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\mplexporter\exporter.py", line 138, in crawl_ax
self.draw_patch(ax, patch)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\mplexporter\exporter.py", line 227, in draw_patch
mplobj=patch)
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\leaflet_renderer.py", line 125, in draw_path
rings = list(iter_rings(data, pathcodes))
File "C:\ProgramData\Anaconda3\lib\site-packages\mplleaflet\utils.py", line 14, in iter_rings
raise ValueError('Unrecognized code: {}'.format(code))
ValueError: Unrecognized code: C
Any idea on how to solve this ?
===========================
EDIT :
Just to see what would happen, I tried doing the same thing than this, which is changing
elif code == 'L': ring.append(point)
to
elif code == 'L' or code == 'Z' or code == 'S' or code == 'C': ring.append(point)
in mplleaflet\utils.py, line 11 and 12. Here is what I got :
===========================
EDIT 2 to answer comment
mpl.patches.Rectangle and plt.Rectangle show up :
rect1 = mpl.patches.Rectangle((x,y), 1, 1, color = 'r')
rect2 = plt.Rectangle((x, y), 1, 1, fc='r')
Which seems to fit with a rectangle of 1 degree in latitude and 1 degree longitude (see here) (maybe ? Seems a bit small).
As for Polygons, well... At least they show up, but I guess there is a projection problem :
regpol1 = mpl.patches.RegularPolygon((x,y), 100, radius=r, color = 'r')
cirpol1 = mpl.patches.CirclePolygon((x +50,y), radius=r, color = 'b')