repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
plotnine
plotnine-main/tests/test_geom_violin.py
import numpy as np import pandas as pd import pytest from plotnine import aes, coord_flip, facet_grid, geom_violin, ggplot from plotnine.data import mtcars n = 4 m = 10 df = pd.DataFrame( { "x": np.repeat([chr(65 + i) for i in range(n)], m), "y": ( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ...
3,889
27.814815
79
py
plotnine
plotnine-main/tests/test_geom_bin_2d.py
import numpy as np import pandas as pd from plotnine import aes, geom_bin_2d, ggplot, scale_x_log10 from .conftest import layer_data n = 20 # Make even for best results reps = np.hstack( [np.arange(int(np.ceil(n / 2))), np.arange(int(np.ceil(n // 2)))[::-1]] ) diagonal = np.repeat(np.arange(n), reps) df = pd.D...
1,080
25.365854
75
py
plotnine
plotnine-main/tests/test_qplot.py
import numpy as np import pandas as pd import pytest from plotnine import qplot from plotnine.exceptions import PlotnineWarning def test_scalars(): p = qplot(x=2, y=3) assert p == "scalars" def test_arrays(): p = qplot(x=np.arange(5), y=np.arange(5)) assert p == "arrays" def test_string_arrays():...
1,581
19.282051
69
py
plotnine
plotnine-main/tests/test_geom_point.py
import string import numpy as np import pandas as pd from plotnine import ( aes, coord_equal, geom_point, ggplot, guides, lims, scale_color_identity, scale_shape_manual, ) def test_aesthetics(): df = pd.DataFrame( { "a": range(5), "b": 2, ...
3,609
23.391892
79
py
plotnine
plotnine-main/tests/test_annotation_stripes.py
import numpy as np import pandas as pd import pytest from plotnine import ( aes, annotation_stripes, coord_flip, facet_wrap, geom_point, geom_vline, ggplot, ) n = 9 df = pd.DataFrame({"x": np.arange(n) % 3 + 1, "y": range(n)}) def test_annotation_stripes(): p = ( ggplot(df) ...
2,884
22.08
61
py
plotnine
plotnine-main/tests/test_geom_vline.py
import pandas as pd import pytest from plotnine import aes, geom_point, geom_vline, ggplot from plotnine.exceptions import PlotnineError, PlotnineWarning df = pd.DataFrame( {"xintercept": [1, 2], "x": [0.5, 3], "y": [-1, 1], "z": range(2)} ) def test_aesthetics(): p = ( ggplot(df) + geom_poi...
1,134
25.395349
73
py
plotnine
plotnine-main/tests/test_theme.py
import os import pytest from plotnine import ( aes, element_blank, element_line, element_text, facet_grid, facet_wrap, geom_point, ggplot, labs, theme, theme_538, theme_bw, theme_classic, theme_dark, theme_gray, theme_light, theme_linedraw, theme...
7,629
27.901515
79
py
plotnine
plotnine-main/tests/test_geom_blank.py
from plotnine import aes, geom_blank, ggplot from plotnine.data import mtcars def test_blank(): gg = ggplot(mtcars, aes(x="wt", y="mpg")) gg = gg + geom_blank() assert gg == "blank"
196
20.888889
45
py
plotnine
plotnine-main/tests/test_stat_hull.py
from plotnine import aes, geom_point, ggplot, stat_hull from plotnine.data import mtcars def test_hull(): p = ( ggplot(mtcars) + aes("wt", "mpg", color="factor(cyl)") + geom_point() + stat_hull(size=1) ) assert p == "hull"
270
18.357143
55
py
plotnine
plotnine-main/tests/test_geom_pointdensity.py
import numpy as np import pandas as pd from plotnine import ( aes, after_stat, geom_point, geom_pointdensity, ggplot, scale_size_radius, ) n = 16 # Some even number > 2 df = pd.DataFrame({"x": range(n), "y": np.repeat(range(n // 2), 2)}) p0 = ggplot(df, aes("x", "y")) def test_pointdensit...
648
17.027778
72
py
plotnine
plotnine-main/tests/test_geom_bar_col_histogram.py
import numpy as np import pandas as pd from plotnine import ( aes, after_stat, geom_bar, geom_col, geom_histogram, geom_text, ggplot, scale_x_sqrt, ) from plotnine.stats.binning import freedman_diaconis_bins from .conftest import layer_data n = 10 # Some even number greater than 2 #...
2,155
22.692308
77
py
plotnine
plotnine-main/tests/test_facets.py
import numpy as np import pandas as pd from plotnine import ( aes, annotate, facet_grid, facet_wrap, geom_abline, geom_path, geom_point, ggplot, ) from plotnine.data import mpg, mtcars n = 10 df = pd.DataFrame( { "x": range(n), "y": range(n), "var1": np.repe...
4,673
23.34375
78
py
plotnine
plotnine-main/tests/test_geom_ribbon_area.py
import numpy as np import pandas as pd from plotnine import ( aes, after_stat, coord_flip, facet_wrap, geom_area, geom_line, geom_ribbon, ggplot, scale_x_continuous, ) n = 4 # No. of ribbions in a vertical stack m = 100 # Points width = 2 * np.pi # width of each ribbon x = np.li...
4,123
24.45679
76
py
plotnine
plotnine-main/tests/test_geom_spoke.py
import numpy as np import pandas as pd from plotnine import aes, geom_spoke, ggplot n = 4 df = pd.DataFrame( { "x": [1] * n, "y": range(n), "angle": np.linspace(0, np.pi / 2, n), "radius": range(1, n + 1), "z": range(n), } ) def test_aesthetics(): p = ( gg...
857
22.833333
76
py
plotnine
plotnine-main/tests/test_stat_calculate_methods.py
import numpy as np import pandas as pd import pytest from plotnine import aes, ggplot, stat_bin, stat_density, xlim from plotnine.exceptions import PlotnineError, PlotnineWarning def test_stat_bin(): x = [1, 2, 3] y = [1, 2, 3] df = pd.DataFrame({"x": x, "y": y}) # About the default bins gg = gg...
999
25.315789
72
py
plotnine
plotnine-main/tests/test_ggplot_internals.py
from copy import deepcopy import numpy as np import pandas as pd import pytest from plotnine import ( aes, after_scale, after_stat, annotate, coord_trans, facet_null, geom_bar, geom_histogram, geom_line, geom_point, ggplot, ggtitle, guides, labs, lims, s...
9,860
24.746736
76
py
plotnine
plotnine-main/tests/test_geom_sina.py
import numpy as np import pandas as pd import pytest from plotnine import aes, coord_flip, geom_sina, geom_violin, ggplot n = 50 random_state = np.random.RandomState(123) uni = random_state.normal(5, 0.25, n) bi = np.hstack( [random_state.normal(4, 0.25, n), random_state.normal(6, 0.25, n)] ) tri = np.hstack( ...
1,672
21.013158
75
py
plotnine
plotnine-main/tests/test_scale_labelling.py
import pandas as pd from plotnine import ( aes, element_text, facet_grid, geom_point, ggplot, labs, theme, ) from plotnine.data import mtcars c1 = "This is a sample caption" c2 = """\ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the indust...
1,136
21.294118
77
py
plotnine
plotnine-main/tests/test_save_as_pdf_pages.py
import warnings from pathlib import Path import matplotlib.pyplot as plt import pytest from plotnine import aes, geom_text, ggplot, ggtitle, theme from plotnine.data import mtcars from plotnine.exceptions import PlotnineError, PlotnineWarning from plotnine.ggplot import save_as_pdf_pages def p(N=3): """Return *...
3,271
29.867925
79
py
plotnine
plotnine-main/tests/test_lint_and_format.py
import os import subprocess from pathlib import Path import pytest # Helps contributors catch linter errors # when they run make test. is_CI = os.environ.get("CI") is not None @pytest.mark.skipif(is_CI, reason="Helps contributors catch linter errors") def test_ruff(): plotnine_dir = str(Path(__file__).parent.p...
1,229
27.604651
75
py
plotnine
plotnine-main/tests/test_annotation_logticks.py
import numpy as np import pandas as pd import pytest from mizani.transforms import log_format, log_trans from plotnine import ( aes, annotation_logticks, coord_flip, element_line, facet_wrap, geom_point, ggplot, scale_x_continuous, scale_x_log10, scale_y_log10, theme, ) from...
6,403
26.367521
74
py
plotnine
plotnine-main/tests/test_stat_ecdf.py
import pandas as pd from plotnine import aes, after_stat, ggplot, stat_ecdf df = pd.DataFrame({"x": range(10)}) p = ggplot(df, aes("x")) + stat_ecdf(size=2) def test_ecdf(): p = ggplot(df, aes("x")) + stat_ecdf(size=2) assert p == "ecdf" def test_computed_y_column(): p = ( ggplot(df, aes("x")...
566
22.625
69
py
plotnine
plotnine-main/tests/test_geom_map.py
import numpy as np from geopandas import GeoDataFrame from shapely.geometry import ( LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, ) from plotnine import aes, facet_wrap, geom_map, ggplot, labs, theme def test_geometries(): # Points points = [Point(0, 0), Poin...
3,507
26.622047
79
py
plotnine
plotnine-main/tests/test_annotate.py
import pandas as pd import pytest from plotnine import aes, annotate, geom_point, geom_rect, geom_segment, ggplot from plotnine.exceptions import PlotnineError n = 4 df = pd.DataFrame({"x": range(n), "y": range(n)}) def test_multiple_annotation_geoms(): p = ( ggplot(df, aes("x", "y")) + geom_poi...
1,167
22.836735
79
py
plotnine
plotnine-main/tests/test_geom_crossbar.py
import pandas as pd from plotnine import aes, geom_crossbar, ggplot n = 4 df = pd.DataFrame( { "x": [1] * n, "ymin": range(1, 2 * n + 1, 2), "y": [i + 0.1 + i / 10 for i in range(1, 2 * n + 1, 2)], "ymax": range(2, 2 * n + 2, 2), "z": range(n), } ) def test_aesthetics...
724
24.892857
79
py
plotnine
plotnine-main/tests/test_geom_qq_qq_line.py
import numpy as np import pandas as pd from plotnine import aes, geom_qq, geom_qq_line, ggplot random_state = np.random.RandomState(1234567890) df_normal = pd.DataFrame({"x": random_state.normal(size=100)}) def test_normal(): p = ggplot(df_normal, aes(sample="x")) + geom_qq() # Roughly a straight line of po...
566
27.35
71
py
plotnine
plotnine-main/tests/test_scale_internals.py
import warnings from datetime import datetime import numpy as np import numpy.testing as npt import pandas as pd import pytest from plotnine import ( aes, annotate, element_text, expand_limits, facet_wrap, geom_bar, geom_col, geom_point, ggplot, lims, theme, ) from plotnine...
22,129
25.856796
77
py
plotnine
plotnine-main/tests/test_stat_function.py
import numpy as np import pandas as pd import pytest from plotnine import aes, arrow, ggplot, stat_function from plotnine.exceptions import PlotnineError n = 10 df = pd.DataFrame({"x": range(1, n + 1)}) def test_limits(): p = ( ggplot(df, aes("x")) + stat_function( fun=np.cos, size=2...
1,402
22.779661
76
py
plotnine
plotnine-main/tests/test_geom_abline.py
import pandas as pd import pytest from plotnine import aes, geom_abline, geom_point, ggplot from plotnine.exceptions import PlotnineWarning df = pd.DataFrame( { "slope": [1, 1], "intercept": [1, -1], "x": [-1, 1], "y": [-1, 1], "z": range(2), } ) def test_aesthetics()...
1,498
22.793651
79
py
plotnine
plotnine-main/tests/test_aes.py
import pandas as pd from plotnine import aes, geom_col, ggplot df = pd.DataFrame( { "x": pd.Categorical(["b", "d", "c", "a"], ordered=True), "y": [1, 2, 3, 4], } ) def test_reorder(): p = ( ggplot(df, aes("reorder(x, y)", "y", fill="reorder(x, y)")) + geom_col() ) ...
884
22.289474
67
py
plotnine
plotnine-main/tests/test_geom.py
import pandas as pd import pytest from plotnine import aes, geom_point, ggplot, stat_identity from plotnine.exceptions import PlotnineError from plotnine.geoms.geom import geom df = pd.DataFrame({"col1": [1, 2, 3, 4], "col2": 2, "col3": list("abcd")}) def test_geom_basics(): class geom_abc(geom): DEFAUL...
1,776
26.765625
74
py
plotnine
plotnine-main/tests/test_coords.py
import numpy as np import pandas as pd import pytest from mizani.transforms import trans_new from plotnine import ( aes, coord_fixed, coord_flip, coord_trans, geom_bar, geom_line, ggplot, xlim, ) n = 10 # Some even number greater than 2 # ladder: 0 1 times, 1 2 times, 2 3 times, ... ...
1,531
22.569231
77
py
plotnine
plotnine-main/tests/test_watermark.py
from pathlib import Path import pandas as pd from plotnine import aes, geom_point, ggplot, watermark wm_file = Path(__file__).parent / "images/plotnine-watermark.png" def test_watermark(): df = pd.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3]}) p = ( ggplot(df) + geom_point(aes("x", "y")) ...
434
19.714286
65
py
plotnine
plotnine-main/tests/test_utils.py
import itertools import random import string import warnings import numpy as np import pandas as pd from plotnine.data import mtcars from plotnine.utils import ( _margins, add_margins, join_keys, match, ninteraction, pivot_apply, remove_missing, uniquecols, ) def test__margins(): ...
6,449
25.763485
73
py
plotnine
plotnine-main/tests/test_geom_freqpoly.py
import numpy as np import pandas as pd from plotnine import ( aes, geom_freqpoly, geom_histogram, geom_point, ggplot, ) n = 10 # Some even number greater than 2 # ladder: 0 1 times, 1 2 times, 2 3 times, ... df = pd.DataFrame( { "x": np.repeat(range(n + 1), range(n + 1)), "z"...
652
19.40625
71
py
plotnine
plotnine-main/plotnine/doctools.py
from __future__ import annotations import re import typing from functools import lru_cache from textwrap import dedent, indent, wrap import numpy as np if typing.TYPE_CHECKING: from typing import Any, Type, TypeVar from plotnine.typing import Geom, Scale, Stat T = TypeVar("T") # Parameter arguments t...
16,232
26.467005
79
py
plotnine
plotnine-main/plotnine/iapi.py
""" Internal API Specifications for containers that will hold different kinds of objects with data created when the plot is being built. """ from __future__ import annotations import typing from copy import copy from dataclasses import dataclass, fields if typing.TYPE_CHECKING: from typing import Any, Dict, Iter...
5,738
20.90458
77
py
plotnine
plotnine-main/plotnine/layer.py
from __future__ import annotations import typing from copy import copy, deepcopy from typing import Iterable, List, overload import pandas as pd from .exceptions import PlotnineError from .mapping.aes import NO_GROUP, SCALED_AESTHETICS, aes from .mapping.evaluation import evaluate, stage from .utils import array_kin...
16,379
28.40754
78
py
plotnine
plotnine-main/plotnine/labels.py
from __future__ import annotations import typing from .exceptions import PlotnineError from .iapi import labels_view from .mapping.aes import SCALED_AESTHETICS, rename_aesthetics if typing.TYPE_CHECKING: import plotnine as p9 __all__ = ("xlab", "ylab", "labs", "ggtitle") VALID_LABELS = SCALED_AESTHETICS | {"cap...
1,919
20.573034
76
py
plotnine
plotnine-main/plotnine/exceptions.py
from __future__ import annotations import warnings from textwrap import dedent from typing import Optional, Type, Union # Show the warnings on one line, leaving out any code makes the # message clear def warning_format( message: Union[Warning, str], category: Type[Warning], filename: str, lineno: int...
973
18.877551
63
py
plotnine
plotnine-main/plotnine/typing.py
from __future__ import annotations import typing if typing.TYPE_CHECKING: from typing import ( Any, Callable, Dict, Literal, Protocol, Sequence, TypeVar, ) import numpy as np import numpy.typing as npt import pandas as pd from matplotlib...
7,791
29.319066
77
py
plotnine
plotnine-main/plotnine/utils.py
""" Little functions used all over the codebase """ from __future__ import annotations import collections import inspect import itertools import typing import warnings from contextlib import suppress from warnings import warn from weakref import WeakValueDictionary import numpy as np import pandas as pd import pandas...
33,720
24.879509
79
py
plotnine
plotnine-main/plotnine/ggplot.py
from __future__ import annotations import typing from collections.abc import Sequence from copy import deepcopy from itertools import chain from pathlib import Path from types import SimpleNamespace as NS from typing import Any, Dict, Iterable, Optional, Union from warnings import warn import pandas as pd from .coor...
26,257
29.675234
79
py
plotnine
plotnine-main/plotnine/options.py
from __future__ import annotations import typing if typing.TYPE_CHECKING: from typing import Any #: Development flag, e.g. set to ``True`` to prevent #: the queuing up of figures when errors happen. close_all_figures = False #: Theme used when none is added to the ggplot object current_theme = None #: The base...
1,671
20.164557
63
py
plotnine
plotnine-main/plotnine/watermark.py
from __future__ import annotations import typing if typing.TYPE_CHECKING: import pathlib from typing import Any import matplotlib.figure import plotnine as p9 __all__ = ("watermark",) class watermark: """ Add watermark to plot Parameters ---------- filename : str | pathlib.Pa...
1,610
21.068493
53
py
plotnine
plotnine-main/plotnine/__init__.py
from importlib.metadata import PackageNotFoundError, version try: __version__ = version("plotnine") except PackageNotFoundError: # package is not installed pass finally: del version del PackageNotFoundError # Imports below are generated with the following command: # # python -c "from plotnine.util...
6,116
20.924731
77
py
plotnine
plotnine-main/plotnine/qplot.py
from __future__ import annotations import typing from contextlib import suppress from warnings import warn import numpy as np import pandas as pd from .exceptions import PlotnineError, PlotnineWarning from .facets import facet_grid, facet_null, facet_wrap from .facets.facet_grid import parse_grid_facets from .facets...
7,466
28.630952
78
py
plotnine
plotnine-main/plotnine/animation.py
from __future__ import annotations import typing from copy import copy import pandas as pd from matplotlib.animation import ArtistAnimation from .exceptions import PlotnineError if typing.TYPE_CHECKING: from typing import Iterable from plotnine.typing import ( Artist, Axes, Figure, ...
7,300
31.02193
75
py
plotnine
plotnine-main/plotnine/positions/position_nudge.py
from __future__ import annotations import typing from .position import position if typing.TYPE_CHECKING: from plotnine.typing import FloatArray, FloatArrayLike class position_nudge(position): """ Nudge points Useful to nudge labels away from the points being labels. Parameters -------...
943
19.977778
61
py
plotnine
plotnine-main/plotnine/positions/position.py
from __future__ import annotations import typing from copy import copy from warnings import warn import numpy as np from ..exceptions import PlotnineError, PlotnineWarning from ..mapping.aes import X_AESTHETICS, Y_AESTHETICS from ..utils import ( Registry, check_required_aesthetics, groupby_apply, is...
8,108
29.144981
78
py
plotnine
plotnine-main/plotnine/positions/position_identity.py
from .position import position class position_identity(position): """ Do not adjust the position """ @classmethod def compute_layer(cls, data, params, layout): return data
203
16
49
py
plotnine
plotnine-main/plotnine/positions/position_stack.py
from __future__ import annotations import typing from warnings import warn import numpy as np import pandas as pd from ..exceptions import PlotnineWarning from ..utils import remove_missing from .position import position if typing.TYPE_CHECKING: from plotnine.typing import Scale, Trans class position_stack(po...
4,355
28.632653
79
py
plotnine
plotnine-main/plotnine/positions/position_dodge.py
from contextlib import suppress from copy import copy import numpy as np import pandas as pd from ..exceptions import PlotnineError from ..utils import groupby_apply, match from .position import position class position_dodge(position): """ Dodge overlaps and place objects side-by-side Parameters --...
3,444
29.486726
78
py
plotnine
plotnine-main/plotnine/positions/position_jitterdodge.py
from contextlib import suppress from copy import copy from ..exceptions import PlotnineError from ..mapping.aes import SCALED_AESTHETICS from ..utils import jitter, resolution from .position import position from .position_dodge import position_dodge # Adjust position by simultaneously dodging and jittering class pos...
3,264
29.801887
65
py
plotnine
plotnine-main/plotnine/positions/position_jitter.py
from __future__ import annotations import typing from copy import deepcopy import numpy as np from ..utils import jitter, resolution from .position import position if typing.TYPE_CHECKING: from plotnine.typing import FloatArray, FloatArrayLike class position_jitter(position): """ Jitter points to avoi...
2,138
27.52
67
py
plotnine
plotnine-main/plotnine/positions/position_fill.py
from .position_stack import position_stack class position_fill(position_stack): """ Normalise stacked objects to unit height """ fill = True
160
15.1
44
py
plotnine
plotnine-main/plotnine/positions/__init__.py
""" Position Adjustments """ from .position_dodge import position_dodge from .position_dodge2 import position_dodge2 from .position_fill import position_fill from .position_identity import position_identity from .position_jitter import position_jitter from .position_jitterdodge import position_jitterdodge from .positio...
594
24.869565
54
py
plotnine
plotnine-main/plotnine/positions/position_dodge2.py
from __future__ import annotations import typing from copy import copy import numpy as np import pandas as pd from ..exceptions import PlotnineError from ..utils import groupby_apply, pivot_apply from .position_dodge import position_dodge if typing.TYPE_CHECKING: from plotnine.typing import IntArray class pos...
5,467
31.164706
79
py
plotnine
plotnine-main/plotnine/scales/scale_shape.py
from warnings import warn from ..doctools import document from ..exceptions import PlotnineError, PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_discrete # All these shapes are filled shapes = ( "o", # circle "^", # triangle up "s", # square "D", # Diamond ...
2,194
19.324074
79
py
plotnine
plotnine-main/plotnine/scales/scale_size.py
from warnings import warn import numpy as np from mizani.bounds import rescale_max from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_datetime, scale_discrete @document class scale_size_ordinal(scale_discrete): """ Di...
3,381
21.697987
67
py
plotnine
plotnine-main/plotnine/scales/limits.py
import sys from contextlib import suppress import pandas as pd from ..exceptions import PlotnineError from ..geoms import geom_blank from ..mapping.aes import ALL_AESTHETICS, aes from ..scales.scales import make_scale from ..utils import array_kind # By adding limits, we create a scale of the appropriate type class...
5,598
22.136364
72
py
plotnine
plotnine-main/plotnine/scales/_expand.py
from __future__ import annotations import typing import numpy as np from mizani.bounds import expand_range_distinct from ..iapi import range_view from ..utils import ignore_warnings if typing.TYPE_CHECKING: from typing import Type from plotnine.typing import ( CoordRange, Trans, Tup...
1,515
20.971014
63
py
plotnine
plotnine-main/plotnine/scales/scale.py
from __future__ import annotations import typing from contextlib import suppress from copy import copy, deepcopy from warnings import warn import numpy as np import pandas as pd from mizani.bounds import censor, expand_range_distinct, rescale, zero_range from ..doctools import document from ..exceptions import Plotn...
34,712
29.638129
78
py
plotnine
plotnine-main/plotnine/scales/scale_linetype.py
from warnings import warn from ..doctools import document from ..exceptions import PlotnineError, PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_discrete LINETYPES = ["solid", "dashed", "dashdot", "dotted"] @document class scale_linetype(scale_discrete): """ Scale for l...
1,445
19.956522
69
py
plotnine
plotnine-main/plotnine/scales/scale_color.py
from __future__ import annotations import typing from warnings import warn from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_datetime, scale_discrete if typing.TYPE_CHECKING: from typing import Literal # Discrete color ...
15,040
24.36425
78
py
plotnine
plotnine-main/plotnine/scales/scale_manual.py
from __future__ import annotations import typing from warnings import warn from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_discrete if typing.TYPE_CHECKING: from plotnine.typing import ScaleBreaksRaw @document class _scale_manual(scale...
5,046
25.286458
76
py
plotnine
plotnine-main/plotnine/scales/scales.py
from __future__ import annotations import itertools import typing from contextlib import suppress from typing import List from warnings import warn import numpy as np import pandas.api.types as pdtypes from ..exceptions import PlotnineError, PlotnineWarning from ..mapping.aes import aes_to_scale from ..utils import ...
9,747
27.502924
79
py
plotnine
plotnine-main/plotnine/scales/scale_xy.py
from __future__ import annotations import typing from itertools import chain import numpy as np import pandas as pd from ..doctools import document from ..exceptions import PlotnineError from ..iapi import range_view from ..utils import alias, array_kind, match from ._expand import expand_range from .range import Ra...
10,362
23.269321
78
py
plotnine
plotnine-main/plotnine/scales/scale_identity.py
from __future__ import annotations import typing from ..doctools import document from ..utils import alias from .scale import scale_continuous, scale_discrete if typing.TYPE_CHECKING: from typing import Any, Literal, Sequence class MapTrainMixin: """ Override map and train methods """ guide: L...
2,487
18.138462
63
py
plotnine
plotnine-main/plotnine/scales/__init__.py
""" Scales """ # limits from .limits import expand_limits, lims, xlim, ylim # alpha from .scale_alpha import ( scale_alpha, scale_alpha_continuous, # pyright: ignore scale_alpha_datetime, scale_alpha_discrete, scale_alpha_ordinal, ) # pyright: reportGeneralTypeIssues=true # fill # color from .sca...
6,171
23.299213
51
py
plotnine
plotnine-main/plotnine/scales/scale_stroke.py
from warnings import warn import numpy as np from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_discrete @document class scale_stroke_continuous(scale_continuous): """ Continuous Stroke Scale Parameters -----...
1,750
21.448718
66
py
plotnine
plotnine-main/plotnine/scales/scale_alpha.py
from warnings import warn import numpy as np from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_continuous, scale_datetime, scale_discrete @document class scale_alpha(scale_continuous): """ Continuous Alpha Scale Parameters --...
2,313
21.910891
67
py
plotnine
plotnine-main/plotnine/scales/range.py
from __future__ import annotations import typing from mizani.scale import scale_continuous, scale_discrete if typing.TYPE_CHECKING: from typing import Any, Sequence from plotnine.typing import TupleFloat2 class Range: """ Base class for all ranges """ #: Holds the range information after ...
1,423
19.342857
79
py
plotnine
plotnine-main/plotnine/_mpl/patches.py
from __future__ import annotations import typing from matplotlib.patches import FancyBboxPatch from matplotlib.text import _get_textbox from matplotlib.transforms import Affine2D if typing.TYPE_CHECKING: from matplotlib.backend_bases import RendererBase from plotnine.typing import StripPosition from .t...
1,951
26.111111
71
py
plotnine
plotnine-main/plotnine/_mpl/ticker.py
from matplotlib.ticker import FixedFormatter, locale class MyFixedFormatter(FixedFormatter): """ Override MPL fixedformatter for better formatting """ def format_data(self, value: float) -> str: """ Return a formatted string representation of a number. """ s = locale.f...
386
24.8
61
py
plotnine
plotnine-main/plotnine/_mpl/_plotnine_tight_layout.py
""" Routines to adjust subplot params so that subplots are nicely fit in the figure. In doing so, only axis labels, tick labels, axes titles and offsetboxes that are anchored to axes are currently considered. Internally, this module assumes that the margins (left margin, etc.) which are differences between ``Axes.get_...
23,746
27.003538
79
py
plotnine
plotnine-main/plotnine/_mpl/layout_engine.py
from __future__ import annotations import typing from dataclasses import asdict, dataclass from matplotlib.layout_engine import LayoutEngine if typing.TYPE_CHECKING: from typing import Optional from matplotlib.backend_bases import RendererBase from matplotlib.offsetbox import AnchoredOffsetbox from ...
3,074
26.455357
73
py
plotnine
plotnine-main/plotnine/_mpl/utils.py
from __future__ import annotations import typing from .transforms import ZEROS_BBOX if typing.TYPE_CHECKING: from matplotlib.backend_bases import RendererBase from matplotlib.transforms import Bbox from plotnine.typing import ( Artist, Axes, Figure, ) def bbox_in_figure_spa...
1,292
23.396226
60
py
plotnine
plotnine-main/plotnine/_mpl/text.py
from __future__ import annotations import typing from matplotlib.text import Text from .patches import SFancyBboxPatch from .utils import bbox_in_axes_space if typing.TYPE_CHECKING: from matplotlib.backend_bases import RendererBase from plotnine.iapi import strip_draw_info class SText(Text): """ ...
1,968
27.536232
74
py
plotnine
plotnine-main/plotnine/_mpl/__init__.py
0
0
0
py
plotnine
plotnine-main/plotnine/_mpl/offsetbox.py
import matplotlib.transforms as mtransforms from matplotlib.offsetbox import AuxTransformBox, DrawingArea class ColoredDrawingArea(DrawingArea): """ A Drawing Area with a background color """ def __init__( self, width: float, height: float, xdescent=0.0, ydesce...
1,715
24.61194
70
py
plotnine
plotnine-main/plotnine/_mpl/transforms.py
from matplotlib.transforms import Bbox ZEROS_BBOX = Bbox([[0, 0], [0, 0]])
76
18.25
38
py
plotnine
plotnine-main/plotnine/geoms/geom_errorbarh.py
from __future__ import annotations import typing import numpy as np import pandas as pd from ..doctools import document from ..utils import copy_missing_columns, resolution from .geom import geom from .geom_path import geom_path from .geom_segment import geom_segment if typing.TYPE_CHECKING: from typing import ...
2,218
25.416667
70
py
plotnine
plotnine-main/plotnine/geoms/geom_histogram.py
from ..doctools import document from .geom_bar import geom_bar @document class geom_histogram(geom_bar): """ Histogram {usage} Parameters ---------- {common_parameters} See Also -------- plotnine.geoms.geom_bar """ DEFAULT_PARAMS = {"stat": "bin", "position": "stack", "...
335
14.272727
73
py
plotnine
plotnine-main/plotnine/geoms/geom.py
from __future__ import annotations import typing from copy import deepcopy from itertools import chain, repeat import pandas as pd from ..exceptions import PlotnineError from ..layer import layer from ..mapping.aes import is_valid_aesthetic, rename_aesthetics from ..mapping.evaluation import evaluate from ..position...
15,835
28.544776
77
py
plotnine
plotnine-main/plotnine/geoms/geom_col.py
from ..doctools import document from .geom_bar import geom_bar @document class geom_col(geom_bar): """ Bar plot with base on the x-axis This is an alternate version of :class:`geom_bar` that maps the height of bars to an existing variable in your data. If you want the height of the bar to represe...
852
22.054054
65
py
plotnine
plotnine-main/plotnine/geoms/annotate.py
from __future__ import annotations import typing import pandas as pd from ..exceptions import PlotnineError from ..geoms.geom import geom as geom_base_class from ..mapping import aes from ..mapping.aes import POSITION_AESTHETICS from ..utils import Registry, is_scalar_or_string if typing.TYPE_CHECKING: from typ...
4,080
26.389262
76
py
plotnine
plotnine-main/plotnine/geoms/geom_blank.py
from __future__ import annotations import typing from ..doctools import document from .geom import geom if typing.TYPE_CHECKING: from typing import Any import pandas as pd from plotnine.iapi import panel_view from plotnine.typing import Axes, Coord @document class geom_blank(geom): """ An...
784
15.702128
60
py
plotnine
plotnine-main/plotnine/geoms/geom_quantile.py
from ..doctools import document from .geom_path import geom_path @document class geom_quantile(geom_path): """ Quantile lines from a quantile regression {usage} Parameters ---------- {common_parameters} lineend : str (default: butt) Line end style, of of *butt*, *round* or *proje...
831
22.111111
62
py
plotnine
plotnine-main/plotnine/geoms/geom_smooth.py
from __future__ import annotations import typing from ..doctools import document from ..utils import to_rgba from .geom import geom from .geom_line import geom_line, geom_path from .geom_ribbon import geom_ribbon if typing.TYPE_CHECKING: from typing import Any import pandas as pd from plotnine.iapi imp...
3,375
24.969231
77
py
plotnine
plotnine-main/plotnine/geoms/geom_map.py
from __future__ import annotations import typing import numpy as np import pandas as pd from ..doctools import document from ..exceptions import PlotnineError from ..utils import SIZE_FACTOR, to_rgba from .geom import geom from .geom_point import geom_point from .geom_polygon import geom_polygon if typing.TYPE_CHEC...
9,438
29.15655
79
py
plotnine
plotnine-main/plotnine/geoms/geom_linerange.py
from __future__ import annotations import typing from ..doctools import document from .geom import geom from .geom_path import geom_path from .geom_segment import geom_segment if typing.TYPE_CHECKING: from typing import Any import pandas as pd from plotnine.iapi import panel_view from plotnine.typi...
1,238
18.983871
72
py
plotnine
plotnine-main/plotnine/geoms/geom_abline.py
from __future__ import annotations import typing from typing import Sized from warnings import warn import numpy as np import pandas as pd from ..doctools import document from ..exceptions import PlotnineWarning from ..mapping import aes from ..utils import order_as_data_mapping from .geom import geom from .geom_pat...
3,113
25.615385
77
py
plotnine
plotnine-main/plotnine/geoms/geom_hline.py
from __future__ import annotations import typing from warnings import warn import numpy as np import pandas as pd from ..doctools import document from ..exceptions import PlotnineWarning from ..mapping import aes from ..utils import order_as_data_mapping from .geom import geom from .geom_path import geom_path from ....
2,384
23.336735
77
py
plotnine
plotnine-main/plotnine/geoms/geom_line.py
from __future__ import annotations import typing from ..doctools import document from .geom_path import geom_path if typing.TYPE_CHECKING: import pandas as pd @document class geom_line(geom_path): """ Connected points {usage} Parameters ---------- {common_parameters} See Also ...
528
16.633333
69
py
plotnine
plotnine-main/plotnine/geoms/geom_point.py
from __future__ import annotations import typing import numpy as np from ..doctools import document from ..scales.scale_shape import FILLED_SHAPES from ..utils import SIZE_FACTOR, to_rgba from .geom import geom if typing.TYPE_CHECKING: from typing import Any import pandas as pd from plotnine.iapi impo...
4,030
24.19375
74
py
plotnine
plotnine-main/plotnine/geoms/geom_dotplot.py
from __future__ import annotations import typing from warnings import warn import numpy as np from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import groupby_apply, resolution, to_rgba from .geom import geom if typing.TYPE_CHECKING: from typing import Any import pandas ...
8,509
31.605364
77
py
plotnine
plotnine-main/plotnine/geoms/geom_pointrange.py
from __future__ import annotations import typing from ..doctools import document from .geom import geom from .geom_linerange import geom_linerange from .geom_path import geom_path from .geom_point import geom_point if typing.TYPE_CHECKING: from typing import Any import pandas as pd from plotnine.iapi i...
2,162
22.769231
70
py
plotnine
plotnine-main/plotnine/geoms/geom_errorbar.py
from __future__ import annotations import typing import numpy as np import pandas as pd from ..doctools import document from ..utils import copy_missing_columns, resolution from .geom import geom from .geom_path import geom_path from .geom_segment import geom_segment if typing.TYPE_CHECKING: from typing import ...
2,203
25.238095
70
py
plotnine
plotnine-main/plotnine/geoms/geom_segment.py
from __future__ import annotations import typing import numpy as np import pandas as pd from ..doctools import document from ..utils import SIZE_FACTOR, interleave, make_line_segments, to_rgba from .geom import geom from .geom_path import geom_path if typing.TYPE_CHECKING: from typing import Any from plotn...
2,889
26.52381
72
py