Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Scatter Plot Returns Different Plots in Different Versions #21482

Closed
@sadrasabouri

Description

@sadrasabouri

Bug summary

I'm working on a generative art generator library for python calledSamila based on the matplotlib scatter plot. It gets two functions and maps a square space into a arbitrary shape. We want the generated shape to be the same for given functions and given random seed in order to be reproducible.

Recently we were working on functions with complex values and notified that scatter plot output is not the same in different versions on matplotlib.

I wanted to know why is it like this and what's the problem with matplotlib. If this is a bug it could be horrible for matplotlib to plot different figures for a specific code in its different versions.

Code for reproduction

importrandomimportmathimportmatplotlib.pyplotaspltimportitertoolsdeff1(x,y):returnmath.cos(x**2*y)**1.926-math.floor(x-y)**1.861-math.floor(y**2*x)**1.688deff2(x,y):returnx-y**1.617-math.ceil(y)**1.477-abs(x**2*y)**1.647-math.cos(x*y)**1.668deffloat_range(start,stop,step):whilestart<stop:yieldfloat(start)start+=stepdata1= []data2= []range1=list(float_range(-1*math.pi,math.pi,0.01))range_prod=list(itertools.product(range1,range1))foriteminrange_prod:data1.append(f1(item[0],item[1]))data2.append(f2(item[0],item[1]))color= (0.159,0.085,0.191)spot_size=0.01projection="polar"fig=plt.figure()fig.set_size_inches(10,10)ax=fig.add_subplot(111,projection=projection)ax.scatter(data2,data1,alpha=0.1,edgecolors=color,s=spot_size)ax.set_axis_off()ax.patch.set_zorder(-1)ax.add_artist(ax.patch)plt.show()

Actual outcome

inmatplotlib.__version__ == 3.0.3:

matplotlib3 0 3

inmatplotlib.__version__ == 3.4.3:

matplotlib3 4 3

Expected outcome

Same result in different versions.

Operating system

Ubuntu 20.04

Matplotlib Version

3.0.3 and3.4.3

Python version

3.8.10



[You can track this bug in thestackoverflow too]

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp