Problem maintaing order with geom_tile and duplicated data [duplicate]
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:
r ggplot2
marked as duplicate by zx8754
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.
add a comment |
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:
r ggplot2
marked as duplicate by zx8754
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
add a comment |
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:
r ggplot2
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:
This question already has an answer here:
ggplot2 geom_bar - how to keep order of data.frame
1 answer
r ggplot2
r ggplot2
asked Nov 26 '18 at 13:20
A89A89
246
246
marked as duplicate by zx8754
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
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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()
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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()
add a comment |
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()
add a comment |
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()
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()
answered Nov 26 '18 at 13:40
community wiki
zx8754
add a comment |
add a comment |
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