Problem maintaing order with geom_tile and duplicated data [duplicate]












0
















This question already has an answer here:




  • ggplot2 geom_bar - how to keep order of data.frame

    1 answer




I am trying to don't loose the order of dataframe, the information has order in the dataframe.
But since the data is duplicated into the dataframe, I am obtaining error message or introducing NA.
I didnt find a solution similar for this, I tried with this How to preserve the order of tiles in geom_tile ggplot, but it didn't work



library(readr)
library(ggplot2)
library(RColorBrewer)

url_soccer <- 'https://raw.githubusercontent.com/frm1789/soccer_ea/master/tableau.m.csv'

tableau.m <- read_csv(url_soccer)

tableau.m <- tableau.m[,-1]

(p <- ggplot(tableau.m, aes(Team, variable)) +
geom_tile(aes(fill = rescale), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue"))


The expected solution is this:
How the visualization should be...










share|improve this question













marked as duplicate by zx8754 r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 13:41


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

    – A89
    Nov 26 '18 at 15:25
















0
















This question already has an answer here:




  • ggplot2 geom_bar - how to keep order of data.frame

    1 answer




I am trying to don't loose the order of dataframe, the information has order in the dataframe.
But since the data is duplicated into the dataframe, I am obtaining error message or introducing NA.
I didnt find a solution similar for this, I tried with this How to preserve the order of tiles in geom_tile ggplot, but it didn't work



library(readr)
library(ggplot2)
library(RColorBrewer)

url_soccer <- 'https://raw.githubusercontent.com/frm1789/soccer_ea/master/tableau.m.csv'

tableau.m <- read_csv(url_soccer)

tableau.m <- tableau.m[,-1]

(p <- ggplot(tableau.m, aes(Team, variable)) +
geom_tile(aes(fill = rescale), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue"))


The expected solution is this:
How the visualization should be...










share|improve this question













marked as duplicate by zx8754 r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 13:41


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

    – A89
    Nov 26 '18 at 15:25














0












0








0









This question already has an answer here:




  • ggplot2 geom_bar - how to keep order of data.frame

    1 answer




I am trying to don't loose the order of dataframe, the information has order in the dataframe.
But since the data is duplicated into the dataframe, I am obtaining error message or introducing NA.
I didnt find a solution similar for this, I tried with this How to preserve the order of tiles in geom_tile ggplot, but it didn't work



library(readr)
library(ggplot2)
library(RColorBrewer)

url_soccer <- 'https://raw.githubusercontent.com/frm1789/soccer_ea/master/tableau.m.csv'

tableau.m <- read_csv(url_soccer)

tableau.m <- tableau.m[,-1]

(p <- ggplot(tableau.m, aes(Team, variable)) +
geom_tile(aes(fill = rescale), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue"))


The expected solution is this:
How the visualization should be...










share|improve this question















This question already has an answer here:




  • ggplot2 geom_bar - how to keep order of data.frame

    1 answer




I am trying to don't loose the order of dataframe, the information has order in the dataframe.
But since the data is duplicated into the dataframe, I am obtaining error message or introducing NA.
I didnt find a solution similar for this, I tried with this How to preserve the order of tiles in geom_tile ggplot, but it didn't work



library(readr)
library(ggplot2)
library(RColorBrewer)

url_soccer <- 'https://raw.githubusercontent.com/frm1789/soccer_ea/master/tableau.m.csv'

tableau.m <- read_csv(url_soccer)

tableau.m <- tableau.m[,-1]

(p <- ggplot(tableau.m, aes(Team, variable)) +
geom_tile(aes(fill = rescale), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue"))


The expected solution is this:
How the visualization should be...





This question already has an answer here:




  • ggplot2 geom_bar - how to keep order of data.frame

    1 answer








r ggplot2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 '18 at 13:20









A89A89

246




246




marked as duplicate by zx8754 r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 13:41


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by zx8754 r
Users with the  r badge can single-handedly close r questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 13:41


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

    – A89
    Nov 26 '18 at 15:25



















  • In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

    – A89
    Nov 26 '18 at 15:25

















In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

– A89
Nov 26 '18 at 15:25





In the others cases (at least as far as I looked for) they didn't find repetitive elements in the columns.

– A89
Nov 26 '18 at 15:25












1 Answer
1






active

oldest

votes


















1














Reorder your variables, see:



tableau.m$Team <- factor(tableau.m$Team, c("Brasil", "Argentina", "Uruguay"))
tableau.m$variable <- factor(tableau.m$variable, c("Titles", "Match", "Points", "Points_1", "Performance"))

ggplot(tableau.m, aes(variable, Team, fill = rescale)) +
geom_tile(show.legend = FALSE) +
scale_fill_gradient(low = "white", high = "steelblue") +
theme_minimal()


enter image description here






share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Reorder your variables, see:



    tableau.m$Team <- factor(tableau.m$Team, c("Brasil", "Argentina", "Uruguay"))
    tableau.m$variable <- factor(tableau.m$variable, c("Titles", "Match", "Points", "Points_1", "Performance"))

    ggplot(tableau.m, aes(variable, Team, fill = rescale)) +
    geom_tile(show.legend = FALSE) +
    scale_fill_gradient(low = "white", high = "steelblue") +
    theme_minimal()


    enter image description here






    share|improve this answer






























      1














      Reorder your variables, see:



      tableau.m$Team <- factor(tableau.m$Team, c("Brasil", "Argentina", "Uruguay"))
      tableau.m$variable <- factor(tableau.m$variable, c("Titles", "Match", "Points", "Points_1", "Performance"))

      ggplot(tableau.m, aes(variable, Team, fill = rescale)) +
      geom_tile(show.legend = FALSE) +
      scale_fill_gradient(low = "white", high = "steelblue") +
      theme_minimal()


      enter image description here






      share|improve this answer




























        1












        1








        1







        Reorder your variables, see:



        tableau.m$Team <- factor(tableau.m$Team, c("Brasil", "Argentina", "Uruguay"))
        tableau.m$variable <- factor(tableau.m$variable, c("Titles", "Match", "Points", "Points_1", "Performance"))

        ggplot(tableau.m, aes(variable, Team, fill = rescale)) +
        geom_tile(show.legend = FALSE) +
        scale_fill_gradient(low = "white", high = "steelblue") +
        theme_minimal()


        enter image description here






        share|improve this answer















        Reorder your variables, see:



        tableau.m$Team <- factor(tableau.m$Team, c("Brasil", "Argentina", "Uruguay"))
        tableau.m$variable <- factor(tableau.m$variable, c("Titles", "Match", "Points", "Points_1", "Performance"))

        ggplot(tableau.m, aes(variable, Team, fill = rescale)) +
        geom_tile(show.legend = FALSE) +
        scale_fill_gradient(low = "white", high = "steelblue") +
        theme_minimal()


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        answered Nov 26 '18 at 13:40


























        community wiki





        zx8754


















            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)