matplotlib / matplotlib/matplotlib

Feature Request: Wireframe 3dplot colormap

Ouverte
#3,562 15 commentaires 3 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

keep New feature topic: mplot3d
Langage dominant
Python
Étoiles
23.2k
Forks
8.5k
Merge moyen
1 j 6 h
PR mergées (30 j)
66

Description

## Problem

Currently, `ax.plot_wireframe()` does not support a colormap; however, this is a very important use case for waterfall plots in spectroscopy.

A workaround was recently implemented in stackoverflow:

http://stackoverflow.com/questions/24909256/how-to-obtain-3d-colored-surface-via-python/26026556#26026556

However, this workaround does not work in the case for datasets in which X and Y are not of the same dimension. For example, if X is 100 points and Y is 50 points and Z(X,Y) is of shape (100X50) the workaround will fail.

I've looked into it, and the workaround fails because it depends on `LineCollection._segment3d`. In the case of equally space data (len(X) = len(Y)), `_segment3d` is ndim=3; otherwise it is ndim=1. This is the expected behavior of converting a list of list into a numpy array. `plot_wireframe()` passes a list of lists into `LineCollection`, and doing `np.array()` on a list of list will return a 1d array when the lists are of unequal length.
## Ideas

To fix this either requires changing how plot_wireframe() sends data into LineCollection3d. If it were to pass an array-object somehow instead of a list of lists, this might alleviate the behavior. Alternatively, perhaps `LineCollection._store3d` could be expanded to handle this case.
## Use cases

I'd expect both of these to work:

```
ax.plot_wireframe(X, Y, Z, cmap='jet')
```

and

```
wires = ax.plot_wireframe(X, Y, Z)
wires.set_cmap('jet')
#would wire.set_array() still be necessary?
```

PS, this might be worth combining with related: #3554 . The resulting product could produce plots like this one from mathworks: http://www.mathworks.com/help/matlab/ref/waterfall_1.png

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par plot_wireframe() et suivez le cheminement de ses données jusqu’à LineCollection, en particulier _segment3d et _store3d. Examinez d’abord l’issue associée #3554 et l’exemple avec des dimensions inégales. Le travail est terminé lorsque les wireframes prennent en charge les cartes de couleurs à la fois pour l’utilisation directe de cmap et avec set_cmap(), y compris lorsque X et Y ont des longueurs différentes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.