Skip to content

contour label does not work well in geographic projections #345

@IAP-FuYaNan

Description

@IAP-FuYaNan

Description

I wanted to plot a contour map in a geographic projection, and the plotting went just fine. However, when I tried to add labels to contours, the results were quite confusing.

Steps to reproduce

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you.

# your code here
# we should be able to copy-paste this into python and exactly reproduce your bug

import proplot as pplt
import pandas as pd
import numpy as np

state = np.random.RandomState(51423)
data = state.rand(6, 6)
data = pd.DataFrame(data, index=pd.Index(['a', 'b', 'c', 'd', 'e', 'f']))

lat = np.linspace(40, 5, 6)
lon = np.linspace(90, 135, 6)

fig = pplt.figure(
    refwidth = 4.5,
    )
ax = fig.subplots(
    proj = 'cyl',
    )
ax.contour(
    lon,
    lat,
    data,
    labels = True,
    )
ax.format(
    lonlim = (90, 135),
    latlim = (5, 40),
    lonlines = 15,
    latlines = 10,
    lonlabels = 'b',
    latlabels = 'l',
    )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions