The error goes something like this (after pruning some long paths): Traceback (most recent call last):įile "/matplotlib/axes.py", line 6100, in scatter I tried to extend the same trick to collapse all calls to ax.scatter into one (by passing a sequence of markers as the marker argument), like this: X, Y, COLOR, MARKER = zip(*((record.x, record.y, record.level, record.marker) X, Y, COLOR = zip(*((record.x, record.y, record.level)įor record in data if record.marker = marker)) for marker in set(record.marker for record in data): This is the reason for creating the scatterplot with multiple calls to ax.scatter, although, admittedly, one could at least reduce the number of calls to scatter to one per maker shape used e.g. (Not for lack of trying: I have putting a lot of time, effort, and even some money, into it.) So I would appreciate complete, working code (even if it's just a toy example), because most likely I won't be able to fill in omitted details or fix bugs in the code.ĮDIT: I fixed an important omission in the "code sketch" above, namely a record-specific marker specification in each call to ax.scatter. NOTE: I find Matplotlib utterly incomprehensible, and this goes for both its design as well as its documentation. What do I need add to the code above to get a vertical colorbar (representing the colormap in cmap) along the plot's right edge? omittedĬanvas = _agg.FigureCanvasAgg(fig)Ĭanvas.print_png('/path/to/output/fig.png') # various settings of ticks, labels, etc. Marker = record.marker # one of 'o', 's', '^', '*', etc.Īx.scatter(record.x, record.y, marker=marker,Ĭ=level, vmin=0, vmax=1, cmap=cmap, **otherkwargs) I create scatterplots with code that, in essence, goes like this cmap = (.įrom_list('blueWhiteRed', ))įig = (figsize=(4, 4), dpi=72)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |