Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply

Number of rows in dataset for R and Python visual objects

How many rows are sampled in the 'dataset' preloaded object for R and Python visual objects? I have about 2 million rows in my dataset

 

If I insert a ggscatterplot as a R visual object in PowerBI, the number of rows used in my case is 2248,

 

This is the R Code:

 

library(ggplot2)

color_palette <- colorRampPalette(c("steelblue", "darkblue"))(length(dataset$Accesos))

ggplot(dataset, aes(x = Edad, y = Hora, size = Accesos, alpha = Accesos, color = Accesos)) +
  geom_point(stroke = NA) +
  scale_size_continuous(range = c(2, 10)) +
  scale_alpha_continuous(range = c(0.1, 0.8)) +
  scale_color_gradientn(colors = color_palette) + 
  labs(
      x = "Edad", y = "Hora", 
      title = "Scatterplot Edad/Horas",
      subtitle = paste("Nº de registros", nrow(dataset)))

 

 

And this is the R visual object result:

Scatterggplot_2.jpg

 

But, if I try to insert a python seaborn density plot  as a Python visual object...

The source:

 

 

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

num_filas = len(dataset)

sns.set(style="white")

sns.kdeplot(data=dataset, x='Hora', y='Edad', fill=True, cmap='viridis', thresh=0, levels=100)

plt.xlabel('Hora')
plt.ylabel('Edad')

plt.title("Grafico de densidad horas-Edad")
plt.suptitle(f"Número de Filas: {num_filas}", y=0.95) 

plt.show()

 

The rows included in dataset are just... 24! And, of course, nothing to plot...

 

PythonDensityPlotPowerBI.jpg

It should look like this (same code, in Google Collab)

 

DensityPython2.png

Is there someting wrong in my code?

 

Thanks!

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.