Code Monkey home page Code Monkey logo

Comments (9)

kassambara avatar kassambara commented on July 20, 2024

Hi,
I'll upgrade the package and let you know as soon as possible.
Thank you for reporting this error.

Best Regards,
A. Kassambara

from easyggplot2.

kassambara avatar kassambara commented on July 20, 2024

Hi,

easyGgplot2 has been updated know.

Install the latest version as follow:

if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/easyGgplot2")

Please, let me know if your code works...

Best Regards,
A. KASSAMBARA

from easyggplot2.

gd047 avatar gd047 commented on July 20, 2024

Thank you.

I only faced a problem (that didn't occur before) when there is a group in
the dataframe with only one observation.
An example follows (sorry for the greek words in the dataset)

PROBLEM (no desnities - only MeanLines)

ggplot2.density(data=dt, xName='mon_kost', groupName='methodos_kataskevis',
xtitle = 'Κόστος (€) / μ.μ.',
yTickLabelFont=c(9, "bold", "black"),
mainTitle="Εξομαλυμένες πυκνότητες μον. κόστους, ανά Μέθοδο Κατασκευής",
brewerPalette='Dark2', legendTitle="Μέθοδος Κατασκευής: ",
ytitle="Πυκνότητα", alpha=0.5, fillGroupDensity=TRUE,
addMeanLine=TRUE, meanLineSize=1) +
theme_bw() +
theme(legend.position = "bottom")

NO PROBLEM

ggplot2.density(data=dt[dt$methodos_kataskevis != "Προβολοδόμηση",],
xName='mon_kost', groupName='methodos_kataskevis', xtitle = 'Κόστος (€) /
μ.μ.',
yTickLabelFont=c(9, "bold", "black"),
mainTitle="Εξομαλυμένες πυκνότητες μον. κόστους, ανά Μέθοδο Κατασκευής",
brewerPalette='Dark2', legendTitle="Μέθοδος Κατασκευής: ",
ytitle="Πυκνότητα", alpha=0.5, fillGroupDensity=TRUE,
addMeanLine=TRUE, meanLineSize=1) +
theme_bw() +
theme(legend.position = "bottom")

DATA

dt <-
structure(
list(
gr_aa = c(
768L, 1042L, 1065L, 1068L, 1099L, 1100L,
673L, 676L, 679L, 681L, 683L, 685L, 686L, 1710L, 687L, 689L,
1713L, 692L, 1719L, 698L, 702L, 703L, 704L, 705L, 1729L,
707L,
1734L, 477L, 481L, 485L, 493L, 495L, 497L, 766L
), ta_type = c(
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα",
"Σιδ. Γέφυρα",
"Σιδ. Γέφυρα", "Σιδ. Γέφυρα", "Σιδ. Γέφυρα"
), perigrafh = c(
"ΣΓ25",
"ΛΑΔΟΠΟΤΑΜΟΥ", "ΣΓ03 ΡΕΜΑ ΣΕΛΙΑΝΔΡΟΥ", "ΣΓ06 ΡΕΜΑ
ΑΓΙΩΡΓΙΤΙΚΟ",
"ΣΓ24", "ΣΓ27", "ΣΓ1 ΜΠΕΚΙΟΡΡΕΜΑΤΟΣ", "ΣΓ3 ΡΕΜΑΤΟΣ
ΠΑΠΑΚΥΡΤΣΟΠΟΥΛΟΥ",
"ΣΓ5 2Η ΡΕΜΑΤΟΣ ΠΑΠΑΚΥΡΤΣΟΠΟΥΛΟΥ", "ΣΓ7 ΡΕΜΑΤΟΣ ΠΛΑΤΑΝΑ",
"ΣΓ8 ΔΡΙΜΑΡΙΟΡΡΕΜΑΤΟΣ",
"ΣΓ9 ΠΡΟΣΩΡΙΝΗ ΣΤΗΝ ΥΦΙΣΤΑΜΕΝΗ ΓΡΑΜΜΗ", "ΣΓ10
ΑΜΠΕΛΟΡΡΕΜΑΤΟΣ",
"ΣΓ19 (ΓΕΦΥΡΑ Γ1) ΘΟΛΟΠΟΤΑΜΟΣ", "ΣΓ11 ΒΟΪΔΟΡΡΕΜΑΤΟΣ",
"ΣΓ28",
"ΣΓ 20 ΒΡΩΜΟΛΑΓΓΑΔΟ", "ΣΓ32", "ΣΓ 21 (ΓΕΦΥΡΑ Γ4) ΦΟΙΝΙΚΑΣ",
"ΣΓ19",
"ΣΓ12 ΒΟΪΔΟΡΡΕΜΑΤΟΣ (1Η)", "ΣΓ13 ΒΟΪΔΟΡΡΕΜΑΤΟΣ (2Η)", "ΣΓ14
ΒΟΪΔΟΡΡΕΜΑΤΟΣ (3Η)",
"ΣΓ15 ΒΟΪΔΟΡΡΕΜΑΤΟΣ (4Η)", "ΣΓ 22", "ΣΓ16 ΒΟΪΔΟΡΡΕΜΑΤΟΣ
(5Η)",
"ΣΓ 24", "ΡΕΜΜΑ ΡΑΧΙΑΝΗΣ (Τ-06)", "ΡΕΜΜΑ ΖΑΠΑΝΤΗ (Τ-11)",
"ΡΕΜΜΑ ΒΑΡΕΛΑ (Τ-14)",
"ΑΣΩΠΟΣ ΠΟΤΑΜΟΣ (T-20)", "ΧΕΙΜΑΡΟΣ ΕΛΙΣΣΩΝΑ (Τ-23)", "ΡΕΜΜΑ
ΚΥΡΙΛΛΟΥ (Τ-25)",
"ΣΓ23Ν"
), route_descr = c(
"ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΚΙΑΤΟ - ΠΑΤΡΑ 59-75",
"ΚΙΑΤΟ - ΠΑΤΡΑ 21-40", "ΚΙΑΤΟ - ΠΑΤΡΑ 21-40", "ΛΙΑΝΟΚΛΑΔΙ -
ΔΟΜΟΚΟΣ",
"ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ

  • ΔΟΜΟΚΟΣ",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ
  • ΔΟΜΟΚΟΣ",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΚΙΑΤΟ -
    ΠΑΤΡΑ 90-109",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΚΙΑΤΟ -
    ΠΑΤΡΑ 90-109",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΚΙΑΤΟ - ΠΑΤΡΑ 90-109", "ΛΙΑΝΟΚΛΑΔΙ
  • ΔΟΜΟΚΟΣ",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΛΙΑΝΟΚΛΑΔΙ
  • ΔΟΜΟΚΟΣ",
    "ΛΙΑΝΟΚΛΑΔΙ - ΔΟΜΟΚΟΣ", "ΚΙΑΤΟ - ΠΑΤΡΑ 90-109", "ΛΙΑΝΟΚΛΑΔΙ
  • ΔΟΜΟΚΟΣ",
    "ΚΙΑΤΟ - ΠΑΤΡΑ 109-120", "ΣΚΑ - ΚΙΑΤΟ", "ΣΚΑ - ΚΙΑΤΟ", "ΣΚΑ
  • ΚΙΑΤΟ",
    "ΣΚΑ - ΚΙΑΤΟ", "ΣΚΑ - ΚΙΑΤΟ", "ΣΚΑ - ΚΙΑΤΟ", "ΛΙΑΝΟΚΛΑΔΙ -
    ΔΟΜΟΚΟΣ"
    ), moni_flag = structure(
    c(
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), .Label = c("Διπλή", "Μονή"), class = "factor"
    ), length = c(
    207, 109.5, 33, 30, 109.8, 207,
    27.31, 117, 40, 20, 117, 14.7, 522, 7.6, 297, 342, 7.6,
    30.14,
    162.8, 18.5, 207, 105, 391, 436, 14, 657, 107.8, 34.5, 20,
    15.5,
    33, 20, 15.4, 84.8
    ), n_anoi = c(
    5L, 4L, 1L, 1L, 5L, 5L, 2L, 3L,
    1L, 1L, 3L, 1L, 12L, 1L, 7L, 8L, 1L, 2L, 6L, 1L, 5L, 3L, 9L,
    10L, 1L, 15L, 4L, 1L, 1L, 1L, 2L, 3L, 1L, 2L
    ), methodos_kataskevis = structure(
    c(
    4L,
    3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 1L, 4L,
    4L, 1L,
    1L, 3L, 1L, 4L, 1L, 4L, 4L, 1L, 2L, 3L, 3L, 3L, 1L, 3L,
    1L, 1L,
    1L
    ), .Label = c("Ικριώματα", "Προβολοδόμηση", "Προκατ. Δοκοί",
    "Σταδ.Προώθηση"), class = "factor"
    ), monad_calc = c(
    5485209.52186329,
    2225149.08111311, 408286.867788583, 581923.566665246,
    1429551.47878868,
    3406355.03767597, 198148.496522405, 2166422.94184525,
    803891.588442578,
    238511.728438278, 2050129.15646762, 395641.234900324,
    6659283.38465548,
    196757.25861, 3697047.76820474, 10904404.0704621,
    360091.332988,
    231692.799668758, 3232140.700194, 212067.407620734,
    3162486.27302504,
    1345555.98279085, 3685027.0096206, 2454772.038332,
    376188.180268,
    3071248.3424493, 3089063.461144, 658487.80250221,
    213139.251551363,
    107944.340851705, 777661.91762768, 784399.13232831,
    606238.818386809,
    1744206.29811606
    ), new_monad_calc = structure(
    c(
    1L, 3L, 5L, 6L,
    7L, 8L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
    25L, 26L,
    27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 42L,
    43L, 44L,
    47L, 48L, 49L, 53L
    ), .Label = c(
    "5.485.209.52", "127.759.47",
    "2.225.149.08", "610.718.21", "408.286.87",
    "581.923.57", "1.429.551.48",
    "3.406.355.04", "13.180.113.95", "822.462.19",
    "162.922.56",
    "180.058.07", "764.184.95", "823.491.63", "239.112.41",
    "198.148.50",
    "2.166.422.94", "803.891.59", "238.511.73",
    "2.050.129.16", "395.641.23",
    "6.659.283.38", "196.757.26", "3.697.047.77",
    "10.904.404.07",
    "360.091.33", "231.692.80", "3.232.140.70",
    "212.067.41", "3.162.486.27",
    "1.345.555.98", "3.685.027.01", "2.454.772.04",
    "376.188.18",
    "3.071.248.34", "3.089.063.46", "1.118.211.17",
    "792.441.66",
    "912.568.76", "2.204.986.68", "1.372.002.68",
    "658.487.80", "213.139.25",
    "107.944.34", "78.350.95", "117.241.26", "777.661.92",
    "784.399.13",
    "606.238.82", "386.521.52", "395.497.18", "94.449.96",
    "1.744.206.30"
    ), class = "factor"
    ), mon_kost = c(
    26498.5967239772, 20320.9961745489,
    12372.3293269268, 19397.4522221749, 13019.5945244871,
    16455.8214380482,
    7255.52898287825, 18516.4354003868, 20097.2897110644,
    11925.5864219139,
    17522.4714228002, 26914.3697211105, 12757.2478633247,
    25889.112975,
    12447.9722835176, 31884.2224282518, 47380.4385510526,
    7687.21963068208,
    19853.4441043857, 11463.1031146343, 15277.7114638891,
    12814.8188837224,
    9424.62150798107, 5630.21109709174, 26870.5843048571,
    4674.65501133836,
    28655.5052054174, 19086.6029710786, 10656.9625775682,
    6964.15102269064,
    23565.5126553842, 39219.9566164155, 39366.1570381045,
    20568.4704966517
    ), new_mon_kost = structure(
    c(
    1L, 3L, 5L, 6L, 7L, 8L, 16L, 17L,
    18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L,
    29L, 30L,
    31L, 32L, 33L, 34L, 35L, 36L, 42L, 43L, 44L, 47L, 48L,
    49L, 53L
    ), .Label = c(
    "26.498.60", "6.846.70", "20.321.00", "12.723.30",
    "12.372.33", "19.397.45", "13.019.59", "16.455.82",
    "45.137.38",
    "41.123.11", "10.768.18", "19.962.09", "42.454.72",
    "45.749.54",
    "9.564.50", "7.255.53", "18.516.44", "20.097.29",
    "11.925.59",
    "17.522.47", "26.914.37", "12.757.25", "25.889.11",
    "12.447.97",
    "31.884.22", "47.380.44", "7.687.22", "19.853.44",
    "11.463.10",
    "15.277.71", "12.814.82", "9.424.62", "5.630.21",
    "26.870.58",
    "4.674.66", "28.655.51", "7.808.74", "9.300.96",
    "7.866.97",
    "7.650.89", "7.967.50", "19.086.60", "10.656.96",
    "6.964.15",
    "5.054.90", "6.513.40", "23.565.51", "39.219.96",
    "39.366.16",
    "25.098.80", "25.681.63", "4.722.50", "20.568.47"
    ), class = "factor"
    )
    ), .Names = c(
    "gr_aa",
    "ta_type", "perigrafh", "route_descr", "moni_flag", "length",
    "n_anoi", "methodos_kataskevis", "monad_calc", "new_monad_calc",
    "mon_kost", "new_mon_kost"
    ), row.names = c(
    1L, 3L, 5L, 6L, 7L,
    8L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L,
    28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 42L, 43L, 44L, 47L,
    48L, 49L, 53L
    ), class = "data.frame"
    )

On Thu, Jan 14, 2016 at 12:36 PM, Alboukadel KASSAMBARA <
[email protected]> wrote:

Hi,

easyGgplot2 has been updated know.

Install the latest version as follow:

if(!require(devtools)) install.packages("devtools")devtools::install_github("kassambara/easyGgplot2")

Please, let me know if your code works...

Best Regards,
A. KASSAMBARA


Reply to this email directly or view it on GitHub
#2 (comment)
.

from easyggplot2.

kassambara avatar kassambara commented on July 20, 2024

Thank you again for your feedback.

This problem is not from easyGgplot2. It's from ggplot2 v2..

I have the same problem when I use ggplot2 v2 original syntax as follow:

# problem
ggplot(dt, aes(x = mon_kost)) +
  geom_density(aes(fill = methodos_kataskevis))

# no problem
ggplot(dt[dt$methodos_kataskevis != "Προβολοδόμηση",], aes(x = mon_kost)) +
  geom_density(aes(fill = methodos_kataskevis), alpha = 0.5)

I think that, it makes sens to remove a group with only one observation, before plotting.

Best Regards,
AK

from easyggplot2.

gd047 avatar gd047 commented on July 20, 2024

Ah, ok
Thank you very much, for your immediate response.

Best Regards,
George

On Thu, Jan 14, 2016 at 1:35 PM, Alboukadel KASSAMBARA <
[email protected]> wrote:

Thank you again for your feedback.

This problem is not from easyGgplot2. It's from ggplot2 v2..

I have the same problem when use ggplot2 v2 original syntax as follow:

problem

ggplot(dt, aes(x = mon_kost)) +
geom_density(aes(fill = methodos_kataskevis))

no problem

ggplot(dt[dt$methodos_kataskevis != "Προβολοδόμηση",], aes(x = mon_kost)) +
geom_density(aes(fill = methodos_kataskevis), alpha = 0.5)

I think that, it makes sens to remove a group with only one observation,
before plotting.

Best Regards,
AK


Reply to this email directly or view it on GitHub
#2 (comment)
.

from easyggplot2.

eghorani avatar eghorani commented on July 20, 2024

Hi, thanks for the great work you're doing.

I'm having a problem dodging bars using ggplot2.barplot.

Using the example code you've provided:

df<-restaurant
ggplot2.barplot(data=df, xName='time', yName="total_bill",
groupName='sex', position=position_dodge())

This produces stacked bars only.

this code works:

ggplot(df, aes(x=time, y=total_bill, fill=sex)) +
geom_bar(stat="identity", position="dodge")

from easyggplot2.

kassambara avatar kassambara commented on July 20, 2024

Hi,

This issue has been fixed now. Please install the latest version.

I would highly suggest to use ggpubr package (read this: http://www.sthda.com/english/wiki/ggpubr-r-package-ggplot2-based-publication-ready-plots), which will be a replacement of easyGgplot2.

For ggpubr::ggbarplot, read this: http://www.sthda.com/english/rpkgs/ggpubr/reference/ggbarplot.html

Best,
/A

from easyggplot2.

eghorani avatar eghorani commented on July 20, 2024

from easyggplot2.

kassambara avatar kassambara commented on July 20, 2024

So, we can close this issue. I really appreciate your comment!!

from easyggplot2.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.