cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hansinator255 Frequent Visitor
Frequent Visitor

Scatter Plot or Line Plot with correctly spaced X values

I'm trying to create a scatter plot with x and y values, similar to how I would do it in Excel. I can write a query to associate distinct numeric x and y values, but when I plot these values, the scatterplot is drawn so that all plots are evenly spaced along the x axis.

 

For instance, I have three points, (2, 3), (3, 5), and (5, 8). Each point is correctly drawn along the y axis at y=3, 5, and 8, respectively. However, while I would expect (3, 5) and (5, 8) to be twice the distance along the x-axis as (2, 3) and (3, 5) are, they are instead evenly spaced. Displaying my data as a line plot produces similar behavior.

 

Each data point also has its own label along the x axis, rather than periodically labeling values as is done with the y-axis. My guess is that it's because Power BI is treating my x-axis data as categories, which would also explain the spacing behavior.

 

Any idea why this is happening, and how to get the scatterplot to behave like Excel?

 

EDIT: A scatterplot in R (drag in the data values from the PowerBI query, use "plot(dataset)") also works correctly. So it's not an issue with my data being malformed.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
v-danhe-msft Super Contributor
Super Contributor

Re: Scatter Plot or Line Plot with correctly spaced X values

Hi @Hansinator255 , 

What is your desired result?

You could modify the X distance and Y distance for your visual in the setting:

1.PNG

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hansinator255 Frequent Visitor
Frequent Visitor

Re: Scatter Plot or Line Plot with correctly spaced X values

OK, I think I figured it out. While my data is numerical, it was not being statically typed as such, and I had to add a Change Type step to my query to change the X and Y columns to Decimal Number. When I did this, the X and Y axes appeared correctly scaled and I could modify the axis scales for both.

4 REPLIES 4
Highlighted
v-danhe-msft Super Contributor
Super Contributor

Re: Scatter Plot or Line Plot with correctly spaced X values

Hi @Hansinator255 , 

What is your desired result?

You could modify the X distance and Y distance for your visual in the setting:

1.PNG

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hansinator255 Frequent Visitor
Frequent Visitor

Re: Scatter Plot or Line Plot with correctly spaced X values

@v-danhe-msftThat does look like what I want, and I do get those options for the Y axis on my data. I do not, however, get those options on my X axis and instead get options for displaying categories, even though both my x and y values are numeric.

 

Note also that an R scatterplot displays this data correctly. I've edited the question post to reflect this.

v-danhe-msft Super Contributor
Super Contributor

Re: Scatter Plot or Line Plot with correctly spaced X values

Hi @Hansinator255 ,

It do could set with the X-axis on my side:

2.PNG

My data(all number):

1.PNG

I suggest you test again or you could download my pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hansinator255 Frequent Visitor
Frequent Visitor

Re: Scatter Plot or Line Plot with correctly spaced X values

OK, I think I figured it out. While my data is numerical, it was not being statically typed as such, and I had to add a Change Type step to my query to change the X and Y columns to Decimal Number. When I did this, the X and Y axes appeared correctly scaled and I could modify the axis scales for both.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 147 members 1,999 guests
Please welcome our newest community members: