numdaplot 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- numdaplot/__init__.py +506 -0
- numdaplot/arrays/__init__.py +5 -0
- numdaplot/arrays/array.py +92 -0
- numdaplot/arrays/array_arithmetic.py +404 -0
- numdaplot/arrays/array_calculation.py +143 -0
- numdaplot/arrays/array_conversion.py +150 -0
- numdaplot/arrays/array_creation.py +371 -0
- numdaplot/arrays/array_data.py +281 -0
- numdaplot/arrays/array_layout.py +179 -0
- numdaplot/arrays/array_logic.py +227 -0
- numdaplot/arrays/array_reflected_arithmetic.py +334 -0
- numdaplot/arrays/array_refusals.py +339 -0
- numdaplot/arrays/array_selection.py +195 -0
- numdaplot/arrays/array_sorting.py +59 -0
- numdaplot/arrays/axis_number.py +58 -0
- numdaplot/arrays/calculation/__init__.py +5 -0
- numdaplot/arrays/calculation/counting_statistics.py +325 -0
- numdaplot/arrays/calculation/location_statistics.py +268 -0
- numdaplot/arrays/calculation/math_function_values.py +183 -0
- numdaplot/arrays/calculation/statistic_values.py +209 -0
- numdaplot/arrays/calculation/time_function_values.py +419 -0
- numdaplot/arrays/conversion/__init__.py +5 -0
- numdaplot/arrays/conversion/array_text.py +62 -0
- numdaplot/arrays/conversion/equality_check.py +72 -0
- numdaplot/arrays/conversion/python_values.py +70 -0
- numdaplot/arrays/conversion/time_text.py +290 -0
- numdaplot/arrays/creation/__init__.py +5 -0
- numdaplot/arrays/creation/date_parts.py +89 -0
- numdaplot/arrays/creation/date_parts_values.py +437 -0
- numdaplot/arrays/creation/distribution.py +54 -0
- numdaplot/arrays/creation/filled_values.py +58 -0
- numdaplot/arrays/creation/list_conversion.py +311 -0
- numdaplot/arrays/creation/list_shape.py +97 -0
- numdaplot/arrays/creation/normal.py +65 -0
- numdaplot/arrays/creation/numpy_conversion.py +149 -0
- numdaplot/arrays/creation/random_integers.py +104 -0
- numdaplot/arrays/creation/random_values.py +97 -0
- numdaplot/arrays/creation/range_values.py +73 -0
- numdaplot/arrays/creation/spacing.py +84 -0
- numdaplot/arrays/creation/spacing_values.py +63 -0
- numdaplot/arrays/creation/uniform.py +63 -0
- numdaplot/arrays/equality.py +68 -0
- numdaplot/arrays/layout/__init__.py +5 -0
- numdaplot/arrays/layout/sorting_values.py +113 -0
- numdaplot/arrays/layout/unique_values.py +49 -0
- numdaplot/arrays/mapping/__init__.py +5 -0
- numdaplot/arrays/mapping/mapped_values.py +286 -0
- numdaplot/arrays/mapping/unmatched.py +50 -0
- numdaplot/arrays/mapping/value_change.py +55 -0
- numdaplot/arrays/mapping/value_mapping.py +161 -0
- numdaplot/arrays/math_functions/__init__.py +5 -0
- numdaplot/arrays/math_functions/absolute.py +27 -0
- numdaplot/arrays/math_functions/cosine.py +28 -0
- numdaplot/arrays/math_functions/exponential.py +27 -0
- numdaplot/arrays/math_functions/logarithm.py +72 -0
- numdaplot/arrays/math_functions/math_function.py +58 -0
- numdaplot/arrays/math_functions/round.py +58 -0
- numdaplot/arrays/math_functions/sine.py +28 -0
- numdaplot/arrays/math_functions/square_root.py +27 -0
- numdaplot/arrays/operations/__init__.py +5 -0
- numdaplot/arrays/operations/boolean_operands.py +48 -0
- numdaplot/arrays/operations/combination.py +157 -0
- numdaplot/arrays/operations/float_errors.py +170 -0
- numdaplot/arrays/operations/integer_bounds.py +175 -0
- numdaplot/arrays/operations/integer_rules.py +397 -0
- numdaplot/arrays/operations/operand.py +139 -0
- numdaplot/arrays/operations/time_arithmetic.py +479 -0
- numdaplot/arrays/operations/time_bounds.py +286 -0
- numdaplot/arrays/operations/time_result_bounds.py +397 -0
- numdaplot/arrays/operations/transformation.py +54 -0
- numdaplot/arrays/operations/type_requirements.py +94 -0
- numdaplot/arrays/replacement.py +66 -0
- numdaplot/arrays/selection/__init__.py +5 -0
- numdaplot/arrays/selection/comparison_masks.py +131 -0
- numdaplot/arrays/selection/membership_masks.py +118 -0
- numdaplot/arrays/selection/missing_mask.py +50 -0
- numdaplot/arrays/selection/region_index.py +178 -0
- numdaplot/arrays/selection/replaced_values.py +120 -0
- numdaplot/arrays/selection/rule_mask.py +83 -0
- numdaplot/arrays/selection/time_reference.py +172 -0
- numdaplot/arrays/shape.py +74 -0
- numdaplot/arrays/type_match.py +51 -0
- numdaplot/data_types/__init__.py +5 -0
- numdaplot/data_types/library.py +57 -0
- numdaplot/data_types/numpy_mapping.py +207 -0
- numdaplot/data_types/pandas_mapping.py +114 -0
- numdaplot/data_types/time_of_day.py +292 -0
- numdaplot/data_types/type.py +224 -0
- numdaplot/data_types/value_family.py +149 -0
- numdaplot/data_types/value_type.py +147 -0
- numdaplot/dates/__init__.py +5 -0
- numdaplot/dates/custom_date_format.py +83 -0
- numdaplot/dates/date_format.py +120 -0
- numdaplot/dates/date_part.py +59 -0
- numdaplot/dates/date_part_unit.py +153 -0
- numdaplot/dates/date_period.py +57 -0
- numdaplot/dates/duration_in.py +58 -0
- numdaplot/dates/duration_unit.py +90 -0
- numdaplot/dates/period_unit.py +101 -0
- numdaplot/dates/time_function.py +56 -0
- numdaplot/dates/time_zone.py +68 -0
- numdaplot/dates/time_zone_change.py +71 -0
- numdaplot/dates/time_zone_mode.py +81 -0
- numdaplot/dates/to_duration.py +58 -0
- numdaplot/errors/__init__.py +7 -0
- numdaplot/errors/broadcast_warning.py +36 -0
- numdaplot/errors/calculation_warning.py +35 -0
- numdaplot/errors/cell_out_of_range_error.py +77 -0
- numdaplot/errors/column_not_found_error.py +64 -0
- numdaplot/errors/conflicting_settings_error.py +60 -0
- numdaplot/errors/dimension_error.py +62 -0
- numdaplot/errors/display_warning.py +32 -0
- numdaplot/errors/duplicate_column_error.py +82 -0
- numdaplot/errors/duplicate_label_error.py +55 -0
- numdaplot/errors/duplicate_statistic_error.py +55 -0
- numdaplot/errors/duplicate_value_error.py +54 -0
- numdaplot/errors/empty_array_error.py +55 -0
- numdaplot/errors/empty_list_error.py +52 -0
- numdaplot/errors/empty_region_error.py +34 -0
- numdaplot/errors/empty_text_error.py +34 -0
- numdaplot/errors/empty_total_error.py +62 -0
- numdaplot/errors/empty_values_error.py +34 -0
- numdaplot/errors/file_access_error.py +70 -0
- numdaplot/errors/file_exists_error.py +62 -0
- numdaplot/errors/file_not_found_error.py +56 -0
- numdaplot/errors/incompatible_charts_error.py +80 -0
- numdaplot/errors/incompatible_types_error.py +104 -0
- numdaplot/errors/integer_overflow_error.py +61 -0
- numdaplot/errors/invalid_base_error.py +52 -0
- numdaplot/errors/invalid_bin_width_error.py +66 -0
- numdaplot/errors/invalid_bounds_error.py +58 -0
- numdaplot/errors/invalid_chart_data_error.py +81 -0
- numdaplot/errors/invalid_color_count_error.py +63 -0
- numdaplot/errors/invalid_color_error.py +51 -0
- numdaplot/errors/invalid_column_name_error.py +52 -0
- numdaplot/errors/invalid_conversion_error.py +119 -0
- numdaplot/errors/invalid_count_error.py +61 -0
- numdaplot/errors/invalid_date_format_error.py +51 -0
- numdaplot/errors/invalid_deviation_error.py +52 -0
- numdaplot/errors/invalid_fraction_error.py +51 -0
- numdaplot/errors/invalid_label_count_error.py +61 -0
- numdaplot/errors/invalid_limits_error.py +111 -0
- numdaplot/errors/invalid_opacity_error.py +52 -0
- numdaplot/errors/invalid_point_size_error.py +52 -0
- numdaplot/errors/invalid_position_error.py +106 -0
- numdaplot/errors/invalid_resolution_error.py +51 -0
- numdaplot/errors/invalid_rotation_error.py +53 -0
- numdaplot/errors/invalid_seed_error.py +53 -0
- numdaplot/errors/invalid_separator_error.py +52 -0
- numdaplot/errors/invalid_shape_error.py +52 -0
- numdaplot/errors/invalid_sheet_name_error.py +54 -0
- numdaplot/errors/invalid_size_error.py +58 -0
- numdaplot/errors/invalid_step_error.py +77 -0
- numdaplot/errors/invalid_suffixes_error.py +61 -0
- numdaplot/errors/invalid_time_zone_change_error.py +63 -0
- numdaplot/errors/invalid_type_error.py +79 -0
- numdaplot/errors/irregular_list_error.py +36 -0
- numdaplot/errors/join_relation_error.py +183 -0
- numdaplot/errors/missing_dependency_error.py +58 -0
- numdaplot/errors/missing_type_error.py +36 -0
- numdaplot/errors/missing_value_error.py +62 -0
- numdaplot/errors/not_single_value_error.py +53 -0
- numdaplot/errors/numdaplot_error.py +25 -0
- numdaplot/errors/numdaplot_warning.py +34 -0
- numdaplot/errors/occupied_cell_error.py +63 -0
- numdaplot/errors/out_of_domain_error.py +70 -0
- numdaplot/errors/readability_warning.py +35 -0
- numdaplot/errors/refused_operation_error.py +64 -0
- numdaplot/errors/refused_setting_error.py +60 -0
- numdaplot/errors/rejected_dates.py +60 -0
- numdaplot/errors/repeated_key.py +36 -0
- numdaplot/errors/shape_mismatch_error.py +67 -0
- numdaplot/errors/time_overflow_error.py +131 -0
- numdaplot/errors/time_zone_mismatch_error.py +83 -0
- numdaplot/errors/unknown_time_zone_error.py +51 -0
- numdaplot/errors/unmatched_value_error.py +81 -0
- numdaplot/errors/unsupported_image_format_error.py +56 -0
- numdaplot/errors/unsupported_index_error.py +38 -0
- numdaplot/errors/unsupported_missing_error.py +129 -0
- numdaplot/errors/unsupported_type_error.py +62 -0
- numdaplot/errors/value_conversion_error.py +215 -0
- numdaplot/ordering/__init__.py +5 -0
- numdaplot/ordering/missing_position.py +46 -0
- numdaplot/ordering/order.py +46 -0
- numdaplot/package_version.py +36 -0
- numdaplot/plots/__init__.py +5 -0
- numdaplot/plots/chart_layer.py +47 -0
- numdaplot/plots/charts/__init__.py +5 -0
- numdaplot/plots/charts/bar_chart.py +98 -0
- numdaplot/plots/charts/bar_layout.py +58 -0
- numdaplot/plots/charts/bin_count.py +61 -0
- numdaplot/plots/charts/bin_width.py +78 -0
- numdaplot/plots/charts/box_chart.py +97 -0
- numdaplot/plots/charts/cell_values.py +61 -0
- numdaplot/plots/charts/chart.py +59 -0
- numdaplot/plots/charts/chart_settings.py +105 -0
- numdaplot/plots/charts/color_scale.py +147 -0
- numdaplot/plots/charts/heatmap_chart.py +92 -0
- numdaplot/plots/charts/histogram_chart.py +93 -0
- numdaplot/plots/charts/line_chart.py +100 -0
- numdaplot/plots/charts/line_type.py +75 -0
- numdaplot/plots/charts/marker_shape.py +113 -0
- numdaplot/plots/charts/missing_chart.py +60 -0
- numdaplot/plots/charts/missing_map_chart.py +27 -0
- numdaplot/plots/charts/orientation.py +58 -0
- numdaplot/plots/charts/outliers.py +49 -0
- numdaplot/plots/charts/percentages.py +55 -0
- numdaplot/plots/charts/pie_chart.py +87 -0
- numdaplot/plots/charts/scatter_chart.py +159 -0
- numdaplot/plots/charts/value_axis.py +66 -0
- numdaplot/plots/data/__init__.py +5 -0
- numdaplot/plots/data/array_values.py +128 -0
- numdaplot/plots/data/chart_data.py +143 -0
- numdaplot/plots/data/chart_values.py +109 -0
- numdaplot/plots/data/column_reading.py +468 -0
- numdaplot/plots/data/heatmap_values.py +63 -0
- numdaplot/plots/data/missing_cells.py +165 -0
- numdaplot/plots/data/pie_values.py +215 -0
- numdaplot/plots/data/point_values.py +249 -0
- numdaplot/plots/data/position_kind.py +83 -0
- numdaplot/plots/data/renamed_layers.py +340 -0
- numdaplot/plots/data/sample_values.py +160 -0
- numdaplot/plots/data/shown_columns.py +248 -0
- numdaplot/plots/data/table_values.py +256 -0
- numdaplot/plots/data/unique_labels.py +45 -0
- numdaplot/plots/drawing/__init__.py +5 -0
- numdaplot/plots/drawing/bar_drawing.py +316 -0
- numdaplot/plots/drawing/box_drawing.py +344 -0
- numdaplot/plots/drawing/cell_merging.py +237 -0
- numdaplot/plots/drawing/chart_texts.py +124 -0
- numdaplot/plots/drawing/color_bar.py +57 -0
- numdaplot/plots/drawing/color_scale_values.py +120 -0
- numdaplot/plots/drawing/default_labels.py +41 -0
- numdaplot/plots/drawing/drawn_chart.py +50 -0
- numdaplot/plots/drawing/grid_axes.py +75 -0
- numdaplot/plots/drawing/heatmap_drawing.py +313 -0
- numdaplot/plots/drawing/histogram_drawing.py +350 -0
- numdaplot/plots/drawing/label_room.py +344 -0
- numdaplot/plots/drawing/label_thinning.py +216 -0
- numdaplot/plots/drawing/layer_alignment.py +319 -0
- numdaplot/plots/drawing/layer_colors.py +123 -0
- numdaplot/plots/drawing/line_drawing.py +85 -0
- numdaplot/plots/drawing/marker_codes.py +20 -0
- numdaplot/plots/drawing/missing_drawing.py +360 -0
- numdaplot/plots/drawing/moment_period_formatter.py +253 -0
- numdaplot/plots/drawing/pie_drawing.py +185 -0
- numdaplot/plots/drawing/plot_axes.py +38 -0
- numdaplot/plots/drawing/plot_drawing.py +288 -0
- numdaplot/plots/drawing/plot_theme.py +45 -0
- numdaplot/plots/drawing/position_axis.py +278 -0
- numdaplot/plots/drawing/scatter_drawing.py +364 -0
- numdaplot/plots/drawing/series_colors.py +177 -0
- numdaplot/plots/drawing/size_inches.py +45 -0
- numdaplot/plots/drawing/style_drawing.py +410 -0
- numdaplot/plots/drawing/text_contrast.py +44 -0
- numdaplot/plots/drawing/tick_rotation.py +354 -0
- numdaplot/plots/drawing/time_axis.py +212 -0
- numdaplot/plots/drawing/whole_numbers.py +72 -0
- numdaplot/plots/figure/__init__.py +5 -0
- numdaplot/plots/figure/cell.py +95 -0
- numdaplot/plots/figure/figure.py +256 -0
- numdaplot/plots/figure/figure_drawing.py +99 -0
- numdaplot/plots/figure/figure_style.py +60 -0
- numdaplot/plots/figure/layout.py +71 -0
- numdaplot/plots/figure/placement.py +150 -0
- numdaplot/plots/layer_reading.py +166 -0
- numdaplot/plots/output/__init__.py +5 -0
- numdaplot/plots/output/image_saving.py +187 -0
- numdaplot/plots/output/plot_display.py +181 -0
- numdaplot/plots/output/shown_object.py +45 -0
- numdaplot/plots/overlay_checks.py +245 -0
- numdaplot/plots/plot.py +31 -0
- numdaplot/plots/plot_data.py +140 -0
- numdaplot/plots/plot_distribution_creation.py +237 -0
- numdaplot/plots/plot_output.py +124 -0
- numdaplot/plots/plot_overlays.py +273 -0
- numdaplot/plots/plot_overview_creation.py +195 -0
- numdaplot/plots/plot_series_creation.py +213 -0
- numdaplot/plots/style/__init__.py +5 -0
- numdaplot/plots/style/axis_settings.py +60 -0
- numdaplot/plots/style/color.py +168 -0
- numdaplot/plots/style/custom_color.py +65 -0
- numdaplot/plots/style/grid_lines.py +49 -0
- numdaplot/plots/style/image_options.py +71 -0
- numdaplot/plots/style/legend_position.py +149 -0
- numdaplot/plots/style/plot_style.py +136 -0
- numdaplot/plots/style/size.py +70 -0
- numdaplot/plots/style/size_unit.py +62 -0
- numdaplot/positions/__init__.py +5 -0
- numdaplot/positions/axis.py +54 -0
- numdaplot/positions/index.py +51 -0
- numdaplot/positions/range.py +90 -0
- numdaplot/positions/region.py +92 -0
- numdaplot/py.typed +0 -0
- numdaplot/ratios/__init__.py +5 -0
- numdaplot/ratios/fraction.py +40 -0
- numdaplot/ratios/measure.py +48 -0
- numdaplot/rules/__init__.py +5 -0
- numdaplot/rules/between.py +78 -0
- numdaplot/rules/bounds.py +83 -0
- numdaplot/rules/case.py +48 -0
- numdaplot/rules/contains.py +63 -0
- numdaplot/rules/equal.py +43 -0
- numdaplot/rules/greater.py +39 -0
- numdaplot/rules/greater_or_equal.py +38 -0
- numdaplot/rules/is_in.py +67 -0
- numdaplot/rules/is_missing.py +25 -0
- numdaplot/rules/is_present.py +25 -0
- numdaplot/rules/less.py +39 -0
- numdaplot/rules/less_or_equal.py +38 -0
- numdaplot/rules/not_equal.py +45 -0
- numdaplot/rules/rule.py +62 -0
- numdaplot/rules/rule_values.py +44 -0
- numdaplot/rules/value_rule.py +110 -0
- numdaplot/settings/__init__.py +5 -0
- numdaplot/settings/argument_types.py +327 -0
- numdaplot/settings/field_types.py +593 -0
- numdaplot/statistics/__init__.py +5 -0
- numdaplot/statistics/count.py +71 -0
- numdaplot/statistics/count_distinct.py +27 -0
- numdaplot/statistics/counted_missing.py +46 -0
- numdaplot/statistics/maximum.py +27 -0
- numdaplot/statistics/mean.py +27 -0
- numdaplot/statistics/median.py +27 -0
- numdaplot/statistics/minimum.py +27 -0
- numdaplot/statistics/most_frequent.py +27 -0
- numdaplot/statistics/most_frequent_count.py +27 -0
- numdaplot/statistics/quantile.py +61 -0
- numdaplot/statistics/standard_deviation.py +29 -0
- numdaplot/statistics/statistic.py +63 -0
- numdaplot/statistics/sum.py +27 -0
- numdaplot/tables/__init__.py +5 -0
- numdaplot/tables/aggregation/__init__.py +5 -0
- numdaplot/tables/aggregation/aggregated_frame.py +189 -0
- numdaplot/tables/aggregation/aggregation.py +97 -0
- numdaplot/tables/aggregation/calculation.py +123 -0
- numdaplot/tables/aggregation/result_column.py +108 -0
- numdaplot/tables/aggregation/row_groups.py +96 -0
- numdaplot/tables/aggregation/statistic_name.py +122 -0
- numdaplot/tables/columns/__init__.py +5 -0
- numdaplot/tables/columns/added_column.py +89 -0
- numdaplot/tables/columns/boolean_conversion.py +144 -0
- numdaplot/tables/columns/boolean_rule.py +59 -0
- numdaplot/tables/columns/bracket_end.py +50 -0
- numdaplot/tables/columns/bracket_names.py +346 -0
- numdaplot/tables/columns/bracketed_column.py +179 -0
- numdaplot/tables/columns/brackets.py +234 -0
- numdaplot/tables/columns/chosen_columns.py +55 -0
- numdaplot/tables/columns/column_choice.py +84 -0
- numdaplot/tables/columns/column_mode.py +64 -0
- numdaplot/tables/columns/column_names.py +186 -0
- numdaplot/tables/columns/conversion.py +103 -0
- numdaplot/tables/columns/converted_column.py +669 -0
- numdaplot/tables/columns/date_conversion.py +526 -0
- numdaplot/tables/columns/date_range.py +135 -0
- numdaplot/tables/columns/name_change.py +67 -0
- numdaplot/tables/columns/new_column.py +79 -0
- numdaplot/tables/columns/number_conversion.py +281 -0
- numdaplot/tables/columns/renamed_columns.py +60 -0
- numdaplot/tables/columns/renaming.py +81 -0
- numdaplot/tables/columns/text_conversion.py +70 -0
- numdaplot/tables/columns/time_conversion.py +313 -0
- numdaplot/tables/columns/time_zone_conversion.py +128 -0
- numdaplot/tables/conflict.py +68 -0
- numdaplot/tables/description/__init__.py +5 -0
- numdaplot/tables/description/described_frame.py +335 -0
- numdaplot/tables/description/description.py +155 -0
- numdaplot/tables/duplicates/__init__.py +5 -0
- numdaplot/tables/duplicates/deduplicated_frame.py +66 -0
- numdaplot/tables/duplicates/deduplication.py +88 -0
- numdaplot/tables/duplicates/keep.py +81 -0
- numdaplot/tables/files/__init__.py +5 -0
- numdaplot/tables/files/column_names.py +60 -0
- numdaplot/tables/files/csv_file.py +265 -0
- numdaplot/tables/files/csv_read_options.py +89 -0
- numdaplot/tables/files/csv_separator.py +41 -0
- numdaplot/tables/files/csv_write_options.py +79 -0
- numdaplot/tables/files/decimal_count.py +42 -0
- numdaplot/tables/files/encoding.py +82 -0
- numdaplot/tables/files/excel_file.py +171 -0
- numdaplot/tables/files/excel_read_options.py +79 -0
- numdaplot/tables/files/excel_sheet.py +50 -0
- numdaplot/tables/files/excel_time_cells.py +146 -0
- numdaplot/tables/files/excel_write_options.py +63 -0
- numdaplot/tables/files/file_access.py +152 -0
- numdaplot/tables/files/file_paths.py +106 -0
- numdaplot/tables/files/json_decimals.py +387 -0
- numdaplot/tables/files/json_file.py +203 -0
- numdaplot/tables/files/json_layout.py +63 -0
- numdaplot/tables/files/json_read_options.py +64 -0
- numdaplot/tables/files/json_write_options.py +71 -0
- numdaplot/tables/files/missing_texts.py +63 -0
- numdaplot/tables/files/optional_package.py +42 -0
- numdaplot/tables/files/pandas_backend.py +11 -0
- numdaplot/tables/files/parquet_file.py +91 -0
- numdaplot/tables/files/parquet_read_options.py +56 -0
- numdaplot/tables/files/sas_file.py +94 -0
- numdaplot/tables/files/sas_read_options.py +67 -0
- numdaplot/tables/files/stata_file.py +83 -0
- numdaplot/tables/files/stata_read_options.py +56 -0
- numdaplot/tables/files/xpt_read_options.py +65 -0
- numdaplot/tables/filtering/__init__.py +5 -0
- numdaplot/tables/filtering/checked_frame.py +60 -0
- numdaplot/tables/filtering/column_mask.py +71 -0
- numdaplot/tables/filtering/column_match.py +62 -0
- numdaplot/tables/filtering/condition.py +94 -0
- numdaplot/tables/filtering/filter.py +74 -0
- numdaplot/tables/filtering/filter_mode.py +67 -0
- numdaplot/tables/filtering/row_mask.py +152 -0
- numdaplot/tables/filtering/rule_moments.py +164 -0
- numdaplot/tables/frames/__init__.py +5 -0
- numdaplot/tables/frames/array_frame.py +95 -0
- numdaplot/tables/frames/cleaned_names.py +132 -0
- numdaplot/tables/frames/column.py +15 -0
- numdaplot/tables/frames/column_values.py +273 -0
- numdaplot/tables/frames/frame_equality.py +130 -0
- numdaplot/tables/frames/frame_normalization.py +459 -0
- numdaplot/tables/frames/named_column_errors.py +85 -0
- numdaplot/tables/frames/pandas_decimals.py +113 -0
- numdaplot/tables/frames/region_positions.py +113 -0
- numdaplot/tables/frames/table_text.py +222 -0
- numdaplot/tables/frames/time_columns.py +345 -0
- numdaplot/tables/frames/time_range_errors.py +117 -0
- numdaplot/tables/frames/time_zones.py +271 -0
- numdaplot/tables/joining/__init__.py +5 -0
- numdaplot/tables/joining/join.py +110 -0
- numdaplot/tables/joining/join_keys.py +367 -0
- numdaplot/tables/joining/join_mode.py +93 -0
- numdaplot/tables/joining/join_relation.py +149 -0
- numdaplot/tables/joining/join_suffixes.py +71 -0
- numdaplot/tables/joining/joined_frame.py +166 -0
- numdaplot/tables/joining/joined_names.py +107 -0
- numdaplot/tables/joining/joined_rows.py +235 -0
- numdaplot/tables/joining/key_types.py +57 -0
- numdaplot/tables/joining/relation.py +78 -0
- numdaplot/tables/missing/__init__.py +5 -0
- numdaplot/tables/missing/missing_count.py +59 -0
- numdaplot/tables/missing/missing_counts.py +214 -0
- numdaplot/tables/missing/missing_drop.py +98 -0
- numdaplot/tables/missing/missing_mode.py +63 -0
- numdaplot/tables/missing/missing_ratio.py +71 -0
- numdaplot/tables/missing/missing_removal.py +257 -0
- numdaplot/tables/missing/missing_summary.py +174 -0
- numdaplot/tables/missing/ratio_comparison.py +70 -0
- numdaplot/tables/pivot/__init__.py +5 -0
- numdaplot/tables/pivot/pivot_table.py +104 -0
- numdaplot/tables/pivot/pivoted_frame.py +244 -0
- numdaplot/tables/preview/__init__.py +5 -0
- numdaplot/tables/preview/notebook_display.py +238 -0
- numdaplot/tables/preview/preview.py +100 -0
- numdaplot/tables/preview/preview_rows.py +55 -0
- numdaplot/tables/preview/shown_columns.py +62 -0
- numdaplot/tables/preview/side.py +82 -0
- numdaplot/tables/sorting/__init__.py +5 -0
- numdaplot/tables/sorting/sort_key.py +71 -0
- numdaplot/tables/sorting/sorted_frame.py +81 -0
- numdaplot/tables/sorting/sorting.py +82 -0
- numdaplot/tables/table.py +71 -0
- numdaplot/tables/table_calculation.py +172 -0
- numdaplot/tables/table_columns.py +214 -0
- numdaplot/tables/table_conversion.py +351 -0
- numdaplot/tables/table_data.py +321 -0
- numdaplot/tables/table_display.py +56 -0
- numdaplot/tables/table_joining.py +80 -0
- numdaplot/tables/table_layout.py +105 -0
- numdaplot/tables/table_missing.py +146 -0
- numdaplot/tables/table_reading.py +451 -0
- numdaplot/tables/table_refusals.py +295 -0
- numdaplot/tables/table_selection.py +163 -0
- numdaplot/tables/table_writing.py +269 -0
- numdaplot-0.1.0.dist-info/METADATA +176 -0
- numdaplot-0.1.0.dist-info/RECORD +474 -0
- numdaplot-0.1.0.dist-info/WHEEL +4 -0
- numdaplot-0.1.0.dist-info/licenses/LICENSE +28 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Merging of the cells of a map too small to give each of them a pixel.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from collections.abc import Callable
|
|
8
|
+
|
|
9
|
+
import numpy
|
|
10
|
+
from matplotlib.axes import Axes
|
|
11
|
+
from numpy.typing import NDArray
|
|
12
|
+
|
|
13
|
+
type CellMerger = Callable[[NDArray[numpy.float64], int, int], NDArray[numpy.float64]]
|
|
14
|
+
"""A function merging cells along an axis into at most a number of bands.
|
|
15
|
+
|
|
16
|
+
.. versionadded:: 0.1.0
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
MINIMUM_BAND_PIXELS = 2
|
|
20
|
+
# Below this share of the pixels before the layout, each cell keeps at least one pixel afterwards.
|
|
21
|
+
FITTING_SHARE = 0.75
|
|
22
|
+
ROW_AXIS = 0
|
|
23
|
+
COLUMN_AXIS = 1
|
|
24
|
+
HALF_CELL = 0.5
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def find_band_count(length_pixels: float) -> int:
|
|
28
|
+
"""
|
|
29
|
+
Return how many bands of cells an axis can show, each one staying visible once the layout narrows the axes.
|
|
30
|
+
|
|
31
|
+
The layout keeps more than half of the length of the axes, so a band of 2 pixels keeps at least 1 pixel.
|
|
32
|
+
|
|
33
|
+
.. versionadded:: 0.1.0
|
|
34
|
+
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
length_pixels
|
|
38
|
+
The length of the axis before the layout, in pixels.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
int
|
|
43
|
+
The number of bands, at least 1.
|
|
44
|
+
|
|
45
|
+
Examples
|
|
46
|
+
--------
|
|
47
|
+
>>> from numdaplot.plots.drawing.cell_merging import find_band_count
|
|
48
|
+
>>> find_band_count(369.6)
|
|
49
|
+
184
|
|
50
|
+
"""
|
|
51
|
+
band_count = int(length_pixels // MINIMUM_BAND_PIXELS)
|
|
52
|
+
shown_band_count = max(band_count, 1)
|
|
53
|
+
|
|
54
|
+
return shown_band_count
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def merge_cells(cells: NDArray[numpy.float64], band_count: int, axis: int) -> NDArray[numpy.float64]:
|
|
58
|
+
"""
|
|
59
|
+
Return the cells merged along an axis into bands, each one keeping the highest value of its cells.
|
|
60
|
+
|
|
61
|
+
Matplotlib only keeps one cell per pixel when it shrinks an image, which would lose most of the marked cells.
|
|
62
|
+
|
|
63
|
+
.. versionadded:: 0.1.0
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
cells
|
|
68
|
+
The cells, in two dimensions.
|
|
69
|
+
band_count
|
|
70
|
+
The most bands kept.
|
|
71
|
+
axis
|
|
72
|
+
The axis merged, 0 for the rows and 1 for the columns.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
NDArray[numpy.float64]
|
|
77
|
+
The merged cells, or the same cells when they fit in the bands.
|
|
78
|
+
|
|
79
|
+
Examples
|
|
80
|
+
--------
|
|
81
|
+
>>> import numpy
|
|
82
|
+
>>> from numdaplot.plots.drawing.cell_merging import merge_cells
|
|
83
|
+
>>> merge_cells(numpy.array([[0.0], [1.0], [0.0], [0.0]]), 2, 0).tolist()
|
|
84
|
+
[[1.0], [0.0]]
|
|
85
|
+
"""
|
|
86
|
+
cell_count = cells.shape[axis]
|
|
87
|
+
if cell_count <= band_count:
|
|
88
|
+
return cells
|
|
89
|
+
|
|
90
|
+
first_cells = find_first_cells(cell_count, band_count)
|
|
91
|
+
merged_cells = numpy.maximum.reduceat(cells, first_cells, axis=axis)
|
|
92
|
+
|
|
93
|
+
return merged_cells
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def average_cells(cells: NDArray[numpy.float64], band_count: int, axis: int) -> NDArray[numpy.float64]:
|
|
97
|
+
"""
|
|
98
|
+
Return the cells merged along an axis into bands, each one showing the mean of the present values of its cells.
|
|
99
|
+
|
|
100
|
+
.. versionadded:: 0.1.0
|
|
101
|
+
|
|
102
|
+
Parameters
|
|
103
|
+
----------
|
|
104
|
+
cells
|
|
105
|
+
The cells, in two dimensions, NaN for a missing value.
|
|
106
|
+
band_count
|
|
107
|
+
The most bands kept.
|
|
108
|
+
axis
|
|
109
|
+
The axis merged, 0 for the rows and 1 for the columns.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
NDArray[numpy.float64]
|
|
114
|
+
The merged cells, NaN for a band without value, or the same cells when they fit in the bands.
|
|
115
|
+
|
|
116
|
+
Examples
|
|
117
|
+
--------
|
|
118
|
+
>>> import numpy
|
|
119
|
+
>>> from numdaplot.plots.drawing.cell_merging import average_cells
|
|
120
|
+
>>> average_cells(numpy.array([[1.0], [3.0], [numpy.nan], [numpy.nan]]), 2, 0).tolist()[0]
|
|
121
|
+
[2.0]
|
|
122
|
+
"""
|
|
123
|
+
cell_count = cells.shape[axis]
|
|
124
|
+
if cell_count <= band_count:
|
|
125
|
+
return cells
|
|
126
|
+
|
|
127
|
+
first_cells = find_first_cells(cell_count, band_count)
|
|
128
|
+
is_present = ~numpy.isnan(cells)
|
|
129
|
+
present_numbers = numpy.nan_to_num(cells)
|
|
130
|
+
totals = numpy.add.reduceat(present_numbers, first_cells, axis=axis)
|
|
131
|
+
present_counts = numpy.add.reduceat(is_present.astype(numpy.float64), first_cells, axis=axis)
|
|
132
|
+
empty_bands = present_counts == 0
|
|
133
|
+
divisors = numpy.where(empty_bands, numpy.nan, present_counts)
|
|
134
|
+
averaged_cells = totals / divisors
|
|
135
|
+
|
|
136
|
+
return averaged_cells
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def find_first_cells(cell_count: int, band_count: int) -> NDArray[numpy.intp]:
|
|
140
|
+
"""
|
|
141
|
+
Return the position of the first cell of each band, the bands sharing the cells evenly.
|
|
142
|
+
|
|
143
|
+
.. versionadded:: 0.1.0
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
cell_count
|
|
148
|
+
The number of cells, above the number of bands.
|
|
149
|
+
band_count
|
|
150
|
+
The number of bands.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
NDArray[numpy.intp]
|
|
155
|
+
One position per band.
|
|
156
|
+
|
|
157
|
+
Examples
|
|
158
|
+
--------
|
|
159
|
+
>>> from numdaplot.plots.drawing.cell_merging import find_first_cells
|
|
160
|
+
>>> find_first_cells(10, 4).tolist()
|
|
161
|
+
[0, 2, 5, 7]
|
|
162
|
+
"""
|
|
163
|
+
band_numbers = numpy.arange(band_count, dtype=numpy.intp)
|
|
164
|
+
first_cells = band_numbers * cell_count // band_count
|
|
165
|
+
|
|
166
|
+
return first_cells
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def fit_cells_to_axes(grid: NDArray[numpy.float64], axes: Axes, merge: CellMerger) -> NDArray[numpy.float64]:
|
|
170
|
+
"""
|
|
171
|
+
Return the cells of a map merged along each direction where the axes have too few pixels for them.
|
|
172
|
+
|
|
173
|
+
.. versionadded:: 0.1.0
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
grid
|
|
178
|
+
The cells of the map.
|
|
179
|
+
axes
|
|
180
|
+
The matplotlib axes drawn on.
|
|
181
|
+
merge
|
|
182
|
+
What a band keeps of its cells: ``merge_cells`` or ``average_cells``.
|
|
183
|
+
|
|
184
|
+
Returns
|
|
185
|
+
-------
|
|
186
|
+
NDArray[numpy.float64]
|
|
187
|
+
The cells to draw, the same ones when they fit.
|
|
188
|
+
|
|
189
|
+
Examples
|
|
190
|
+
--------
|
|
191
|
+
>>> import numpy
|
|
192
|
+
>>> from matplotlib.figure import Figure
|
|
193
|
+
>>> from numdaplot.plots.drawing.cell_merging import fit_cells_to_axes, merge_cells
|
|
194
|
+
>>> axes = Figure().add_subplot()
|
|
195
|
+
>>> fit_cells_to_axes(numpy.zeros((1000, 2)), axes, merge_cells).shape
|
|
196
|
+
(184, 2)
|
|
197
|
+
"""
|
|
198
|
+
row_count, column_count = grid.shape
|
|
199
|
+
shown_cells = grid
|
|
200
|
+
if row_count > axes.bbox.height * FITTING_SHARE:
|
|
201
|
+
row_band_count = find_band_count(axes.bbox.height)
|
|
202
|
+
shown_cells = merge(shown_cells, row_band_count, ROW_AXIS)
|
|
203
|
+
|
|
204
|
+
if column_count > axes.bbox.width * FITTING_SHARE:
|
|
205
|
+
column_band_count = find_band_count(axes.bbox.width)
|
|
206
|
+
shown_cells = merge(shown_cells, column_band_count, COLUMN_AXIS)
|
|
207
|
+
|
|
208
|
+
return shown_cells
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def find_cell_limits(grid: NDArray[numpy.float64]) -> tuple[float, float, float, float]:
|
|
212
|
+
"""
|
|
213
|
+
Return where an image of a map goes, so that each row and column keeps its own number once merged.
|
|
214
|
+
|
|
215
|
+
.. versionadded:: 0.1.0
|
|
216
|
+
|
|
217
|
+
Parameters
|
|
218
|
+
----------
|
|
219
|
+
grid
|
|
220
|
+
The cells of the map before they are merged.
|
|
221
|
+
|
|
222
|
+
Returns
|
|
223
|
+
-------
|
|
224
|
+
tuple[float, float, float, float]
|
|
225
|
+
The left, right, bottom and top limits, the first row being on top.
|
|
226
|
+
|
|
227
|
+
Examples
|
|
228
|
+
--------
|
|
229
|
+
>>> import numpy
|
|
230
|
+
>>> from numdaplot.plots.drawing.cell_merging import find_cell_limits
|
|
231
|
+
>>> find_cell_limits(numpy.zeros((3, 2)))
|
|
232
|
+
(-0.5, 1.5, 2.5, -0.5)
|
|
233
|
+
"""
|
|
234
|
+
row_count, column_count = grid.shape
|
|
235
|
+
cell_limits = (-HALF_CELL, column_count - HALF_CELL, row_count - HALF_CELL, -HALF_CELL)
|
|
236
|
+
|
|
237
|
+
return cell_limits
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Title and axis labels of a Plot, chosen between its style and the defaults of its chart.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
8
|
+
from numdaplot.plots.style.plot_style import PlotStyle
|
|
9
|
+
|
|
10
|
+
DEFAULT_TITLE = "{y_label} by {x_label}"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def choose_title(drawn_chart: DrawnChart, style: PlotStyle) -> str:
|
|
14
|
+
"""
|
|
15
|
+
Return the title of a Plot: the style one, else the one of the chart, else the ``y`` label by the ``x`` label.
|
|
16
|
+
|
|
17
|
+
A label removed with an empty text keeps its default name in the title.
|
|
18
|
+
|
|
19
|
+
.. versionadded:: 0.1.0
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
drawn_chart
|
|
24
|
+
The default title and labels of the chart.
|
|
25
|
+
style
|
|
26
|
+
The title and the labels chosen, None for the default ones.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
str
|
|
31
|
+
The title, empty when the style removes it or when the chart has no label to build it from.
|
|
32
|
+
|
|
33
|
+
Examples
|
|
34
|
+
--------
|
|
35
|
+
>>> import numdaplot as ndp
|
|
36
|
+
>>> from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
37
|
+
>>> from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
38
|
+
>>> from numdaplot.plots.drawing.chart_texts import choose_title
|
|
39
|
+
>>> drawn_chart = DrawnChart("day", "price", False, GridAxes.BOTH, None)
|
|
40
|
+
>>> choose_title(drawn_chart, ndp.PlotStyle())
|
|
41
|
+
'price by day'
|
|
42
|
+
>>> choose_title(drawn_chart, ndp.PlotStyle(x_label="Day"))
|
|
43
|
+
'price by Day'
|
|
44
|
+
"""
|
|
45
|
+
if style.title is not None:
|
|
46
|
+
return style.title
|
|
47
|
+
|
|
48
|
+
if drawn_chart.title is not None:
|
|
49
|
+
return drawn_chart.title
|
|
50
|
+
|
|
51
|
+
x_label = choose_title_label(style.x_label, drawn_chart.x_label)
|
|
52
|
+
y_label = choose_title_label(style.y_label, drawn_chart.y_label)
|
|
53
|
+
if x_label == "" or y_label == "":
|
|
54
|
+
return ""
|
|
55
|
+
|
|
56
|
+
title = DEFAULT_TITLE.format(y_label=y_label, x_label=x_label)
|
|
57
|
+
|
|
58
|
+
return title
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def choose_title_label(style_label: str | None, default_label: str | None) -> str:
|
|
62
|
+
"""
|
|
63
|
+
Return the name of an axis in a title: the style label, else the default label, even for a removed style label.
|
|
64
|
+
|
|
65
|
+
.. versionadded:: 0.1.0
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
style_label
|
|
70
|
+
The label chosen in the style, None for the default and an empty text for no label.
|
|
71
|
+
default_label
|
|
72
|
+
The default label of the chart, None for no label.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
str
|
|
77
|
+
The name, empty when there is none.
|
|
78
|
+
|
|
79
|
+
Examples
|
|
80
|
+
--------
|
|
81
|
+
>>> from numdaplot.plots.drawing.chart_texts import choose_title_label
|
|
82
|
+
>>> choose_title_label("", "price")
|
|
83
|
+
'price'
|
|
84
|
+
"""
|
|
85
|
+
chosen_label = choose_label(style_label, default_label)
|
|
86
|
+
if chosen_label != "":
|
|
87
|
+
return chosen_label
|
|
88
|
+
|
|
89
|
+
default_name = choose_label(None, default_label)
|
|
90
|
+
|
|
91
|
+
return default_name
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def choose_label(style_label: str | None, default_label: str | None) -> str:
|
|
95
|
+
"""
|
|
96
|
+
Return the label of an axis.
|
|
97
|
+
|
|
98
|
+
.. versionadded:: 0.1.0
|
|
99
|
+
|
|
100
|
+
Parameters
|
|
101
|
+
----------
|
|
102
|
+
style_label
|
|
103
|
+
The label chosen in the style, None for the default.
|
|
104
|
+
default_label
|
|
105
|
+
The default label of the chart, None for no label.
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
-------
|
|
109
|
+
str
|
|
110
|
+
The chosen label, else the default one, else an empty text.
|
|
111
|
+
|
|
112
|
+
Examples
|
|
113
|
+
--------
|
|
114
|
+
>>> from numdaplot.plots.drawing.chart_texts import choose_label
|
|
115
|
+
>>> choose_label(None, "price")
|
|
116
|
+
'price'
|
|
117
|
+
"""
|
|
118
|
+
if style_label is not None:
|
|
119
|
+
return style_label
|
|
120
|
+
|
|
121
|
+
if default_label is not None:
|
|
122
|
+
return default_label
|
|
123
|
+
|
|
124
|
+
return ""
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Color bar showing the color scale of a chart.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# The matplotlib stubs leave the keyword arguments of most drawing methods untyped.
|
|
8
|
+
# pyright: reportUnknownMemberType=false
|
|
9
|
+
|
|
10
|
+
from typing import cast
|
|
11
|
+
|
|
12
|
+
import numpy
|
|
13
|
+
from matplotlib.axes import Axes
|
|
14
|
+
from matplotlib.cm import ScalarMappable
|
|
15
|
+
from matplotlib.figure import Figure
|
|
16
|
+
from numpy.typing import NDArray
|
|
17
|
+
|
|
18
|
+
from numdaplot.plots.drawing.whole_numbers import place_whole_ticks
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def add_color_bar(
|
|
22
|
+
axes: Axes, scaled_artist: ScalarMappable, scale_label: str, scaled_numbers: NDArray[numpy.float64]
|
|
23
|
+
) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Draw the color scale of a chart next to its axes, with a label.
|
|
26
|
+
|
|
27
|
+
Its ticks are on whole numbers only when every number colored is whole.
|
|
28
|
+
|
|
29
|
+
.. versionadded:: 0.1.0
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
axes
|
|
34
|
+
The matplotlib axes drawn on.
|
|
35
|
+
scaled_artist
|
|
36
|
+
The points or the cells colored along the scale.
|
|
37
|
+
scale_label
|
|
38
|
+
The label of the color bar, such as the ``color_by`` column of a ScatterChart, empty for none.
|
|
39
|
+
scaled_numbers
|
|
40
|
+
The numbers colored, NaN where a value is missing.
|
|
41
|
+
|
|
42
|
+
Examples
|
|
43
|
+
--------
|
|
44
|
+
>>> import numpy
|
|
45
|
+
>>> from matplotlib.figure import Figure
|
|
46
|
+
>>> from numdaplot.plots.drawing.color_bar import add_color_bar
|
|
47
|
+
>>> figure = Figure()
|
|
48
|
+
>>> axes = figure.add_subplot()
|
|
49
|
+
>>> add_color_bar(axes, axes.scatter([0.0], [1.0], c=[5.0]), "rooms", numpy.array([5.0]))
|
|
50
|
+
>>> figure.axes[1].get_ylabel()
|
|
51
|
+
'rooms'
|
|
52
|
+
"""
|
|
53
|
+
figure = cast(Figure, axes.figure)
|
|
54
|
+
# A color bar takes the opacity of what it describes, so it gets its own scale to stay opaque.
|
|
55
|
+
opaque_scale = ScalarMappable(norm=scaled_artist.norm, cmap=scaled_artist.cmap)
|
|
56
|
+
color_bar = figure.colorbar(opaque_scale, ax=axes, label=scale_label)
|
|
57
|
+
place_whole_ticks(color_bar.ax.yaxis, scaled_numbers)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Values of the color scales of a chart: their matplotlib names and their limits.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any, cast
|
|
8
|
+
|
|
9
|
+
import matplotlib
|
|
10
|
+
import numpy
|
|
11
|
+
from matplotlib.colors import Colormap, ListedColormap
|
|
12
|
+
from numpy.typing import NDArray
|
|
13
|
+
|
|
14
|
+
from numdaplot.plots.charts.color_scale import ColorScale
|
|
15
|
+
|
|
16
|
+
SCALE_NAMES = {
|
|
17
|
+
ColorScale.VIRIDIS: "viridis",
|
|
18
|
+
ColorScale.BLUES: "Blues",
|
|
19
|
+
ColorScale.REDS: "Reds",
|
|
20
|
+
ColorScale.RED_BLUE: "RdBu_r",
|
|
21
|
+
ColorScale.GREENS: "Greens",
|
|
22
|
+
ColorScale.GRAYS: "Greys",
|
|
23
|
+
ColorScale.CIVIDIS: "cividis",
|
|
24
|
+
}
|
|
25
|
+
NO_LIMITS = (None, None)
|
|
26
|
+
SCALES_STARTING_WHITE = frozenset({ColorScale.BLUES, ColorScale.REDS, ColorScale.GREENS, ColorScale.GRAYS})
|
|
27
|
+
# The start of the scale keeps a point of the smallest values visible on a white background.
|
|
28
|
+
VISIBLE_SCALE_START = 0.25
|
|
29
|
+
SCALE_END = 1.0
|
|
30
|
+
SCALE_COLOR_COUNT = 256
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def find_scale_limits(grid: NDArray[numpy.float64], color_scale: ColorScale) -> tuple[float | None, float | None]:
|
|
34
|
+
"""
|
|
35
|
+
Return the values of the two ends of a color scale, centered on 0 for ``RED_BLUE`` around 0.
|
|
36
|
+
|
|
37
|
+
.. versionadded:: 0.1.0
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
grid
|
|
42
|
+
The numbers colored, NaN where a value is missing.
|
|
43
|
+
color_scale
|
|
44
|
+
The color scale.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
tuple[float | None, float | None]
|
|
49
|
+
Opposite limits for ``RED_BLUE`` when the numbers are on both sides of 0, so white means 0, and None
|
|
50
|
+
otherwise, for limits on the smallest and the largest number.
|
|
51
|
+
|
|
52
|
+
Examples
|
|
53
|
+
--------
|
|
54
|
+
>>> import numdaplot as ndp
|
|
55
|
+
>>> import numpy
|
|
56
|
+
>>> from numdaplot.plots.drawing.color_scale_values import find_scale_limits
|
|
57
|
+
>>> find_scale_limits(numpy.array([[-1.0, 4.0]]), ndp.ColorScale.RED_BLUE)
|
|
58
|
+
(-4.0, 4.0)
|
|
59
|
+
"""
|
|
60
|
+
if color_scale != ColorScale.RED_BLUE:
|
|
61
|
+
return NO_LIMITS
|
|
62
|
+
|
|
63
|
+
present = ~numpy.isnan(grid)
|
|
64
|
+
present_numbers = grid[present]
|
|
65
|
+
present_count = len(present_numbers)
|
|
66
|
+
if present_count == 0:
|
|
67
|
+
return NO_LIMITS
|
|
68
|
+
|
|
69
|
+
smallest_number = float(present_numbers.min())
|
|
70
|
+
largest_number = float(present_numbers.max())
|
|
71
|
+
is_below_zero = smallest_number < 0
|
|
72
|
+
is_above_zero = largest_number > 0
|
|
73
|
+
spans_zero = is_below_zero and is_above_zero
|
|
74
|
+
if not spans_zero:
|
|
75
|
+
return NO_LIMITS
|
|
76
|
+
|
|
77
|
+
smallest_distance = abs(smallest_number)
|
|
78
|
+
limit = max(smallest_distance, largest_number)
|
|
79
|
+
|
|
80
|
+
return -limit, limit
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def find_point_colors(color_scale: ColorScale) -> Colormap:
|
|
84
|
+
"""
|
|
85
|
+
Return the matplotlib colors of points colored along a color scale.
|
|
86
|
+
|
|
87
|
+
A scale starting from white loses its lightest colors, so that no point disappears on a white background.
|
|
88
|
+
|
|
89
|
+
.. versionadded:: 0.1.0
|
|
90
|
+
|
|
91
|
+
Parameters
|
|
92
|
+
----------
|
|
93
|
+
color_scale
|
|
94
|
+
The color scale.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
matplotlib.colors.Colormap
|
|
99
|
+
The colors, under the matplotlib name of the scale.
|
|
100
|
+
|
|
101
|
+
Examples
|
|
102
|
+
--------
|
|
103
|
+
>>> import numdaplot as ndp
|
|
104
|
+
>>> from numdaplot.plots.drawing.color_scale_values import find_point_colors
|
|
105
|
+
>>> find_point_colors(ndp.ColorScale.VIRIDIS).name
|
|
106
|
+
'viridis'
|
|
107
|
+
>>> [float(color) < 0.9 for color in find_point_colors(ndp.ColorScale.BLUES)(0.0)[:3]]
|
|
108
|
+
[True, True, False]
|
|
109
|
+
"""
|
|
110
|
+
scale_name = SCALE_NAMES[color_scale]
|
|
111
|
+
full_colors = matplotlib.colormaps[scale_name]
|
|
112
|
+
if color_scale not in SCALES_STARTING_WHITE:
|
|
113
|
+
return full_colors
|
|
114
|
+
|
|
115
|
+
kept_positions = numpy.linspace(VISIBLE_SCALE_START, SCALE_END, SCALE_COLOR_COUNT)
|
|
116
|
+
# Some versions of the matplotlib stubs leave the result of a Colormap unknown.
|
|
117
|
+
kept_colors = cast(Any, full_colors(kept_positions))
|
|
118
|
+
visible_colors = ListedColormap(kept_colors, name=scale_name)
|
|
119
|
+
|
|
120
|
+
return visible_colors
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Default labels of a chart when its data names no column for an axis.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from numdaplot.plots.data.chart_values import Positions
|
|
8
|
+
|
|
9
|
+
ROW_LABEL = "Row"
|
|
10
|
+
COLUMN_LABEL = "Column"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def find_position_label(positions: Positions) -> str:
|
|
14
|
+
"""
|
|
15
|
+
Return the default label of the axis of the positions: the name of their column, else ``Row``.
|
|
16
|
+
|
|
17
|
+
.. versionadded:: 0.1.0
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
positions
|
|
22
|
+
The positions of a chart.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
str
|
|
27
|
+
The label of the axis.
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
--------
|
|
31
|
+
>>> import numpy
|
|
32
|
+
>>> from numdaplot.plots.data.chart_values import Positions
|
|
33
|
+
>>> from numdaplot.plots.data.position_kind import PositionKind
|
|
34
|
+
>>> from numdaplot.plots.drawing.default_labels import find_position_label
|
|
35
|
+
>>> find_position_label(Positions(PositionKind.NUMBERS, numpy.array([0.0]), None))
|
|
36
|
+
'Row'
|
|
37
|
+
"""
|
|
38
|
+
if positions.name is None:
|
|
39
|
+
return ROW_LABEL
|
|
40
|
+
|
|
41
|
+
return positions.name
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
What a drawn chart tells the style of its Plot.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
|
|
9
|
+
from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass(frozen=True)
|
|
13
|
+
class DrawnChart:
|
|
14
|
+
"""
|
|
15
|
+
What a drawn chart tells the style of its Plot: default labels, axis directions and grid lines.
|
|
16
|
+
|
|
17
|
+
.. versionadded:: 0.1.0
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
x_label
|
|
22
|
+
The default label of the axis of the ``x`` values, or None.
|
|
23
|
+
y_label
|
|
24
|
+
The default label of the axis of the series, or None.
|
|
25
|
+
x_on_vertical_axis
|
|
26
|
+
True when the ``x`` values are on the vertical axis, as with horizontal bars.
|
|
27
|
+
grid_axes
|
|
28
|
+
The axes crossed by the grid lines, when the PlotStyle shows them.
|
|
29
|
+
legend_title
|
|
30
|
+
The title of the legend, such as the ``color_by`` column of a ScatterChart, or None.
|
|
31
|
+
title
|
|
32
|
+
The default title when it is not the ``y`` label by the ``x`` label, or None.
|
|
33
|
+
legend_outside
|
|
34
|
+
True when ``LegendPosition.BEST`` places the legend past the axes, the chart filling them.
|
|
35
|
+
|
|
36
|
+
Examples
|
|
37
|
+
--------
|
|
38
|
+
>>> from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
39
|
+
>>> from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
40
|
+
>>> DrawnChart("day", "price", False, GridAxes.BOTH, None).grid_axes
|
|
41
|
+
<GridAxes.BOTH: 1>
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
x_label: str | None
|
|
45
|
+
y_label: str | None
|
|
46
|
+
x_on_vertical_axis: bool
|
|
47
|
+
grid_axes: GridAxes
|
|
48
|
+
legend_title: str | None
|
|
49
|
+
title: str | None = None
|
|
50
|
+
legend_outside: bool = False
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Axes crossed by the grid lines of a chart.
|
|
3
|
+
|
|
4
|
+
.. versionadded:: 0.1.0
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from enum import Enum, auto
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GridAxes(Enum):
|
|
11
|
+
"""
|
|
12
|
+
Axes crossed by the grid lines of a chart, when its PlotStyle shows grid lines.
|
|
13
|
+
|
|
14
|
+
.. versionadded:: 0.1.0
|
|
15
|
+
|
|
16
|
+
Examples
|
|
17
|
+
--------
|
|
18
|
+
>>> import numdaplot as ndp
|
|
19
|
+
>>> from matplotlib.figure import Figure
|
|
20
|
+
>>> from numdaplot.plots.chart_layer import ChartLayer
|
|
21
|
+
>>> from numdaplot.plots.data.array_values import read_array_values
|
|
22
|
+
>>> from numdaplot.plots.drawing.line_drawing import draw_line_chart
|
|
23
|
+
>>> prices = ndp.Array.from_list([12.0, 15.5])
|
|
24
|
+
>>> layer = ChartLayer(ndp.LineChart(), read_array_values(prices, "LineChart"))
|
|
25
|
+
>>> draw_line_chart(Figure().add_subplot(), layer).grid_axes
|
|
26
|
+
<GridAxes.BOTH: 1>
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
BOTH = auto()
|
|
30
|
+
"""
|
|
31
|
+
Grid lines across both axes, as for lines and points.
|
|
32
|
+
|
|
33
|
+
Examples
|
|
34
|
+
--------
|
|
35
|
+
>>> from matplotlib.figure import Figure
|
|
36
|
+
>>> from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
37
|
+
>>> from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
38
|
+
>>> from numdaplot.plots.drawing.style_drawing import draw_grid_lines
|
|
39
|
+
>>> axes = Figure().add_subplot()
|
|
40
|
+
>>> draw_grid_lines(axes, DrawnChart(None, None, False, GridAxes.BOTH, None))
|
|
41
|
+
>>> axes.xaxis.get_gridlines()[0].get_visible()
|
|
42
|
+
True
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
VALUES = auto()
|
|
46
|
+
"""
|
|
47
|
+
Grid lines across the axis of the values only, as for bars, histograms and boxes.
|
|
48
|
+
|
|
49
|
+
Examples
|
|
50
|
+
--------
|
|
51
|
+
>>> from matplotlib.figure import Figure
|
|
52
|
+
>>> from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
53
|
+
>>> from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
54
|
+
>>> from numdaplot.plots.drawing.style_drawing import draw_grid_lines
|
|
55
|
+
>>> axes = Figure().add_subplot()
|
|
56
|
+
>>> draw_grid_lines(axes, DrawnChart(None, None, False, GridAxes.VALUES, None))
|
|
57
|
+
>>> axes.xaxis.get_gridlines()[0].get_visible()
|
|
58
|
+
False
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
NONE = auto()
|
|
62
|
+
"""
|
|
63
|
+
No grid lines, as for pies and heatmaps, whose grid lines would cross the drawing.
|
|
64
|
+
|
|
65
|
+
Examples
|
|
66
|
+
--------
|
|
67
|
+
>>> from matplotlib.figure import Figure
|
|
68
|
+
>>> from numdaplot.plots.drawing.drawn_chart import DrawnChart
|
|
69
|
+
>>> from numdaplot.plots.drawing.grid_axes import GridAxes
|
|
70
|
+
>>> from numdaplot.plots.drawing.style_drawing import draw_grid_lines
|
|
71
|
+
>>> axes = Figure().add_subplot()
|
|
72
|
+
>>> draw_grid_lines(axes, DrawnChart(None, None, False, GridAxes.NONE, None))
|
|
73
|
+
>>> axes.yaxis.get_gridlines()[0].get_visible()
|
|
74
|
+
False
|
|
75
|
+
"""
|