Skip to content

Commit

Permalink
Adjust List* results..
Browse files Browse the repository at this point in the history
Revise docstring in mathics.eval.drawing.plot.eval_ListPlot
  • Loading branch information
rocky committed Sep 27, 2024
1 parent 40ca3fa commit 0fc71d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mathics/builtin/atomic/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class Names(Builtin):
The wildcard '*' matches any character:
>> Names["List*"]
= {List, ListLinePlot, ListLogPlot, ListPlot, ListQ, Listable}
= {List, ListLinePlot, ListLogPlot, ListPlot, ListQ, ListStepPlot, Listable}
The wildcard '@' matches only lowercase characters:
>> Names["List@"]
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/drawing/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ def apply_fn(fn: Callable, x_value: int) -> Optional[float]:
is_joined_plot=False,
filling=False,
use_log_scale=False,
plot_type=ListPlot.DiscretePlot,
list_plot_type=ListPlotType.DiscretePlot,
options=options,
)

Expand Down
25 changes: 14 additions & 11 deletions mathics/eval/drawing/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ def eval_ListPlot(
options: dict,
):
"""
Evaluation part of LisPlot[] and DiscretePlot[]
plot_groups: the plot point data, It can be in a number of different list formats
x_range: the x range that of the area to show in the plot
y_range: the y range that of the area to show in the plot
is_discrete_plot: True if called from DiscretePlot, False if called from ListPlot
is_joined_plot: True if points are to be joined. This never happens in a discrete plot
options: miscellaneous graphics options from underlying M-Expression
Evaluation part of ListPlot like plots. eg DiscretePlot[], ListPlot[], ListLinePlot[], etc.
which are enumerated in ListPlotType.
Parameters;
plot_groups: the plot point data, It can be in a number of different list formats
x_range: the x range that of the area to show in the plot
y_range: the y range that of the area to show in the plot
is_discrete_plot: True if called from DiscretePlot, False if called from ListPlot
is_joined_plot: True if points are to be joined. This never happens in a discrete plot
list_plot_type: the kinds of ListPlots we handle
options: miscellaneous graphics options from underlying M-Expression
"""

if not isinstance(plot_groups, list) or len(plot_groups) == 0:
Expand Down Expand Up @@ -247,9 +250,9 @@ def eval_ListPlot(
break
pass

# For step plots we have 2n - 1 points, which
# we create from the n points here
# We insert a new point from the y coodinate
# For step plots, we have 2n - 1 points These
# we create from the n points here.
# We insert a new point from the y coordinate
# of the previous point in between each new point
# other than the first point
if list_plot_type == ListPlotType.ListStepPlot:
Expand Down

0 comments on commit 0fc71d5

Please sign in to comment.