Note
Die Skalen in den Grafiken zeigen die absoluten Antwortzahlen.
Gold Open Access#
Show code cell source
# In diesem Notebook benötigte Funktionen
import plotly.graph_objects as go
import numpy as np
import pandas as pd
# Einlesen der CSV-Datei
data = pd.read_csv("OpenAccessUmfrage_DATA_2024-02-20_1219.csv")
PERSONAL_INFO_MAPPING = {
1: "FB 01: Rechtswissenschaften",
2: "FB 02: Wirtschaftswissenschaften",
3: "FB 03: Gesellschaftswissenschaften und Philosophie",
4: "FB 04: Psychologie",
5: "FB 05: Evangelische Theologie",
6: "FB 06: Geschichte und Kulturwissenschaften",
7: "FB 09: Germanistik und Kunstwissenschaften",
8: "FB 10: Fremdsprachliche Philologien",
9: "FB 12: Mathematik und Informatik",
10: "FB 13: Physik",
11: "FB 15: Chemie ",
12: "FB 16: Pharmazie",
13: "FB 17: Biologie",
14: "FB 19: Geographie",
15: "FB 20: Medizin",
16: "FB 21: Erziehungswissenschaften",
17: "an einem der wissenschaftlichen Zentren",
18: "an einer Serviceeinrichtung",
19: "in einem Museum / einer Sammlung",
20: "sonstige Einrichtung"
}
"""Mapping der Werte in 'personal_info_2_f161d3' auf entsprechende Institute"""
def create_plot(answerlist: list, data_frame: pd.DataFrame, x_row: str | list[str], y_row: str, title: str = ''):
fig = go.Figure()
answers_field = data_frame[y_row].drop_duplicates().dropna()
if not isinstance(x_row, list):
answers_opts = data_frame[x_row].drop_duplicates().dropna()
grouped_df = [
[a] +
[
data_frame.loc[data_frame[x_row] == a].loc[data_frame[y_row] == b].shape[0] for b in answers_field
] for a in answers_opts
]
else:
grouped_df = [[a] + [np.sum(data_frame.loc[data_frame[y_row] == b][a]) for b in answers_field] for a in x_row]
grouped_df = [ # Add the column containing the aggregated information
i + [np.sum(i[1:])] for i in grouped_df
]
grouped_df = pd.DataFrame(grouped_df, columns=['Answer'] + answers_field.tolist() + ['Alle'])
grouped_df = grouped_df.sort_values('Answer') # Antworten in der Reihenfolge des Mappings anzeigen
columns = answers_field.tolist() + ['Alle']
# interaktives Balkendiagramm erstellen
for col in columns:
fig.add_trace(go.Bar(x=grouped_df['Answer'],
y=grouped_df[col],
name=col,
hovertext = answerlist,
hovertemplate="%{hovertext}, %{y}",
visible=col == 'Alle',
marker=dict(color=grouped_df[col],
cauto=True, colorscale='viridis')))
fig.update_layout(title="", # Die Frage soll im Markdown dargestellt werden, sonst hier Variable title einfügen
xaxis_title='Antworten',
yaxis_title='Anzahl',
barmode='group')
#fig.update_traces(marker_line_width=1.5, marker_line_color="black") # schwarze Randlinie
fig.update_layout(updatemenus=[
dict(
active=len(columns) - 1,
buttons=[dict(
label=columns[c],
method="update",
args=[{"visible": [d == c for d in range(len(columns))]},
# {"title": f"{title} - {columns[c]}"} # Die Frage soll im Markdown dargestellt werden
]
) for c in range(len(columns))],
x=0.25, # Position des Dropdown-Menüs (x-Koordinate)
xanchor="right",
y=1.5, # Position des Dropdown-Menüs (y-Koordinate)
yanchor="top"
)
])
fig.update_xaxes(tickangle=30)
return fig
# Interaktive Funktion für das Dropdown-Menü
def show_plot(answerlist: list, df: pd.DataFrame, answer_tag: str | list[str], answer_mapping: dict, title: str,
personal_info_field: str = 'personal_info_2_f161d3'):
"""
Creates a new plot including a Dropdown select based on the personal-info field. Can be used for one column
containing the answers or multiple columns. If the answer_tag parameter is provided as a list, a list of
column names are expected containing the different answers in a multiple choice question. The column names will be
translated using the answer_mapping dictionary. If the answer_tag parameter is only of type string, only one column
is assumed and the answer_mapping dict, will be used to translate the answer keys in the column.
:param df: The DataFrame containing the data to plot.
:param answer_tag: The name of the column(s) containing the answers.
:param answer_mapping: A mapping to _translate_ the columnnames/answerkeys for human presentation
:param title: The title of the plot.
:param personal_info_field: The column containing the personal information used to create the dropdown.
:return: The figure to display for example in jupyter notebook.
:raises KeyError: If an answer key (or column name) is not provided in the answer_mapping dict.
"""
df = pd.DataFrame(df)
df[personal_info_field] = df[personal_info_field].map(PERSONAL_INFO_MAPPING)
if not isinstance(answer_tag, list):
df[answer_tag] = df[answer_tag].map(answer_mapping)
df_sorted = df.sort_values(
by=personal_info_field,
key=lambda x: pd.Categorical(x, categories=PERSONAL_INFO_MAPPING.values(),
ordered=True)
) # Antworten in der Reihenfolge des Mappings anzeigen
df_sorted = df_sorted[
(answer_tag + [personal_info_field]) if isinstance(answer_tag, list) else [answer_tag,
personal_info_field]
]
if isinstance(answer_tag, list):
answer_mapping.update({personal_info_field: personal_info_field})
answer_tag = list(map(lambda x: answer_mapping[x], answer_tag))
df_sorted.rename(columns=answer_mapping, inplace=True)
fig = create_plot(answerlist, df_sorted, answer_tag, personal_info_field, title)
return fig
Frage 1#
Single Choice
Haben Sie bereits eine oder mehrere Publikationen im Gold OA veröffentlicht?
Show code cell source
# Mapping der Werte in 'gold_oa_1' auf entsprechende Antworten
oa_mapping = {
1: "ja, mehrmals",
2: "ja, ein Mal",
3: "nein",
4: "unsicher"
}
answerlist = ["ja, ein Mal", "ja, mehrmals", "nein", "unsicher"]
question = 'Haben Sie bereits eine oder mehrere Publikationen im Gold OA veröffentlicht?'
answer_id = 'gold_oa_1'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)
Frage 2#
Single Choice
Haben Sie bereits den OA-Publikationsfonds der UB für die finanzielle Unterstützung der Veröffentlichung in Gold OA-Journalen genutzt?
Show code cell source
# Mapping der Werte in 'gold_oa_1_1' auf entsprechende Antworten
oa_mapping = {
1: "ja, mehrmals",
2: "ja, ein Mal",
3: "nein, noch nie",
4: "nein, aber ich plane es in Zukunft"
}
answer_id = 'gold_oa_1_1'
answerlist = ["ja, ein Mal", "ja, mehrmals", "nein, aber ich plane es in Zukunft", "nein, noch nie"]
question = 'Haben Sie bereits den OA-Publikationsfonds der UB für die finanzielle Unterstützung der Veröffentlichung in Gold OA-Journalen genutzt?'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)
Frage 3#
Single Choice Haben Sie bereits den OA-Publikationsfonds der UB für die finanzielle Unterstützung der Veröffentlichung einer Verlagsmonographie genutzt?
Show code cell source
# Mapping der Werte in 'gold_oa_1_2' auf entsprechende Antworten
oa_mapping = {
1: "ja, mehrmals",
2: "ja, ein Mal",
3: "nein, noch nie",
4: "nein, aber ich plane es in Zukunft"
}
answerlist = ["ja, ein Mal", "ja, mehrmals", "nein, aber ich plane es in Zukunft", "nein, noch nie"]
answer_id = 'gold_oa_1_2'
question = 'Haben Sie bereits den OA-Publikationsfonds der UB für die finanzielle Unterstützung der Veröffentlichung einer Verlagsmonographie genutzt?'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)
Frage 4#
Single Choice
Falls Sie bereits den OA-Publikationsfonds genutzt haben: Was hätten Sie ohne den Fonds getan?
Antwort A) Ich hätte trotzdem im Gold OA veröffentlicht und die Publikation anders finanziert.
Antwort B) Ich hätte aufgrund der Kosten anders (ggf. ‘closed’) veröffentlicht.
Antwort C) Ich hätte aufgrund der Kosten anders (ggf. ‘closed’) und anschließend im green OA veröffentlicht.
Antwort D) Ich hätte gar nicht veröffentlicht.
Show code cell source
# Mapping der Werte in 'gold_oa_1_1_1_1e0689' auf entsprechende Antworten
oa_mapping = {
1: "Antwort A)",
2: "Antwort B)",
3: "Antwort C)",
4: "Antwort D)"
}
answerlist = ["Ich hätte trotzdem im Gold OA veröffentlicht und die Publikation anders finanziert.",
"Ich hätte aufgrund der Kosten anders (ggf. 'closed') veröffentlicht.",
"Ich hätte aufgrund der Kosten anders (ggf. 'closed') und anschließend im green OA veröffentlicht.",
"Ich hätte gar nicht veröffentlicht."]
answer_id = 'gold_oa_1_1_1_1e0689'
question = 'Falls Sie bereits den OA-Publikationsfonds genutzt haben: Was hätten Sie ohne den Fonds getan?'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)
Frage 5#
Single Choice
Falls Sie noch nie den OA-Publikationsfonds genutzt haben: Warum?
Antwort A) Ich habe noch nie etwas veröffentlicht.
Antwort B) Ich nutze die OA-Option in den DEAL- und anderen Transformationsverträgen.
Antwort C) Ich konnte meine OA-Veröffentlichungen aus anderen Mitteln finanzieren.
Antwort D) Ich veröffentliche nur closed/subskriptionspfichtig.
Antwort E) Ich wusste nichts von dem Fonds.
Anmerkung: Antworten A und D wurden nicht ausgewählt.
Show code cell source
# Mapping der Werte in 'gold_oa_1_1_1_1e0689' auf entsprechende Antworten
oa_mapping = {
1: "Antwort A)",
2: "Antwort B)",
3: "Antwort C)",
4: "Antwort D)",
5: "Antwort E)"
}
answerlist = ["Ich habe noch nie etwas veröffentlicht.",
"Ich konnte meine OA-Veröffentlichungen aus anderen Mitteln finanzieren.",
"Ich wusste nichts von dem Fonds."
]
answer_id = 'gold_oa_1_1_2_8b97b3'
question = 'Falls Sie noch nie den OA-Publikationsfonds genutzt haben: Warum?'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)
Frage 6#
Single Choice
Wenn Sie noch nie im Gold OA veröffentlicht haben: Warum nicht?
Antwort A) Ich habe noch nie etwas veröffentlicht.
Antwort B) Es stand kein Gold OA Journal mit ausreichend hohem Impact Factor zur Verfügung.
Antwort C) In meinem Fach bieten die Verlage kein Gold OA an.
Antwort D) Ich wusste bisher nichts von den Publikationsoptionen im Gold OA.
Antwort E) Ich bin nicht überzeugt vom Konzept des Gold OA.
Antwort F) sonstiges
Show code cell source
# Mapping der Werte in 'gold_oa_1_3' auf entsprechende Antworten
oa_mapping = {
1: "Antwort A)",
2: "Antwort B)",
3: "Antwort C)",
4: "Antwort D)",
5: "Antwort E)",
6: "Antwort F)"
}
answerlist = ["Ich habe noch nie etwas veröffentlicht.",
"Es stand kein Gold OA Journal mit ausreichend hohem Impact Factor zur Verfügung.",
"In meinem Fach bieten die Verlage kein Gold OA an.",
"Ich wusste bisher nichts von den Publikationsoptionen im Gold OA.",
"Ich bin nicht überzeugt vom Konzept des Gold OA.",
"sonstiges"
]
answer_id = 'gold_oa_1_3'
question = 'Wenn Sie noch nie im Gold OA veröffentlicht haben: Warum nicht?'
fig = show_plot(answerlist, data, answer_id, oa_mapping, question)
display(fig)