@@ -1453,23 +1453,38 @@ output$attrhist <- renderPlot({
14531453 if (nplots == 1 ){
14541454 par(mfrow = c(1 , 1 ))
14551455 lvls <- length(unique(nwdf()[[attrname ]]))
1456- if (attrname %in% numattr() & lvls > 9 ){
1457- tab <- hist.info(nwdf()[[attrname ]], breaks = 10 )
1456+ if (input $ attrhistaxis == " density" & attrname %in% numattr() & lvls > 9 ){
1457+ plot(density(nwdf()[[attrname ]]), main = attrname ,
1458+ col = " #076EC3" , lwd = 2 )
14581459 } else {
1459- tab <- table(nwdf()[[attrname ]])
1460+ if (attrname %in% numattr() & lvls > 9 ){
1461+ tab <- hist.info(nwdf()[[attrname ]], breaks = 10 )
1462+ } else {
1463+ tab <- table(nwdf()[[attrname ]])
1464+ }
1465+ if (input $ attrhistaxis == " percent" ){
1466+ tab <- tab / sum(tab )
1467+ }
1468+ barplot(tab , xlab = attrname , col = histblue )
14601469 }
1461- barplot(tab , xlab = attrname , col = histblue )
14621470 } else {
14631471 r <- ceiling(nplots / 2 )
14641472 par(mfrow = c(r , 2 ))
14651473 for (a in attrname ){
14661474 lvls <- length(unique(nwdf()[[a ]]))
1467- if (a %in% numattr() & lvls > 9 ){
1475+ if (input $ attrhistaxis == " density" & a %in% numattr() & lvls > 9 ){
1476+ plot(density(nwdf()[[a ]]), main = a , col = " #076EC3" , lwd = 2 )
1477+ } else {
1478+ if (a %in% numattr() & lvls > 9 ){
14681479 tab <- hist.info(nwdf()[[a ]], breaks = 10 )
14691480 } else {
14701481 tab <- table(nwdf()[[a ]])
14711482 }
1483+ if (input $ attrhistaxis == " percent" ){
1484+ tab <- tab / sum(tab )
1485+ }
14721486 barplot(tab , xlab = a , col = histblue )
1487+ }
14731488 }
14741489 }
14751490})
0 commit comments